Quantcast
Viewing all articles
Browse latest Browse all 2341

New Post: Microsoft Access 2007 Application.GlobalCallback not triggering/ program freezing

Hello!

Using Win32 version 4.9.3.4 it seems the globalsettings.applicationcallback class fires only sporadically, and often not at all.

Open a instance of the Access form and set the callback using the example code provided in a delayed open function:
Public Function delayedMapLoad(geoID as string) as Long

Dim gs As new GlobalSettings
Set objCallback = New MwCallback
gs.ApplicationCallback = objCallback

//method then loads, reprojects, and adds serveral shapefile layers
//the uses the prefetch to load the tiles for a snapshot
fetchCounter = axMap.Tiles.Prefetch2(tilesExtents.xMin, tilesExtents.xMax, tilesExtents.yMin, tilesExtents.yMax, axMap.Tiles.CurrentZoom, axMap.Tiles.providerID, stopper)

//loop until callback sets picture to ready or there were no tiles to prefetch
Do until fetchCounter tiles = 0 or snapshotready
    DoEvents
Loop

//take snapshot
axmap.takepicture

delayedMapLoad = fetchCounter 

End Function
My MwCallback class is identical to the example code:
Implements ICallback

Private Sub ICallback_Error(ByVal KeyOfSender As String, ByVal ErrorMsg As String)
    Debug.Print ErrorMsg
End Sub

Private Sub ICallback_Progress(ByVal KeyOfSender As String, ByVal Percent As Long, ByVal Message As String)

   //set snapshotready = true when Percent = 100 and Message is correct
    Debug.Print Message & ": " & Percent
End Sub
However the message and percent next print to the log and any breakpoints added in the class just seem to be ignored or, more often, cause the program to crash. Without being able to debug without crashing I can't figure out what the issue is...

I do attempt to load shapefiles from a network drive I have gotten the error "The object has disconnected from its clients" on some occasions, so perhaps a slow/stalled connection is freezes Access. However, the class seems called only sporadically when I move those files locally.

Alternatively I have used the LoadtilesforSnapshot/TilesLoaded methods to accomplish the same thing, but the snapshots often appear to have little some missing tiles.

Should the applicationcallback be set elsewhere? Is my approach with the loop waiting for callback incorrect?
Perhaps I'm approaching all wrong. Any help would be greatly appreciated

Thanks very much!

Viewing all articles
Browse latest Browse all 2341

Trending Articles