'This goes in declarations
Public GE_interface_temp_places_folder As Object 'GE interface Temporary Places folder object
Public GE_interface_temp_places_collection As Object 'GE interface Temporary Places folder contents object
Public GE_interface_temp_places_child As Object 'GE interface Temporary Places folder item object
'This goes in GE_Load
Set GE_interface_temp_places_folder = CreateObject("GoogleEarth.FeatureGE")
Set GE_interface_temp_places_collection = CreateObject("GoogleEarth.FeatureCollectionGE")
Set GE_interface_temp_places_child = CreateObject("GoogleEarth.FeatureGE")
'Rest goes in GE_Send_Kml
' Kml_file = name of kml file
' Internal_name = internal name of kml file (as defined by <name>...</name>)
' Accept_state = flag to indicate if this function is to wait for the kml file
' to appear in GE's Temporary Places folder (True) or disappear
' (False)
'Save millisecs since PC turned on for loop timing
lasttick& = GetTickCount
'Loop until GE accepts kml file or 10 GE latency periods have elapsed...
Do While Abs(GetTickCount - lasttick&) < 10 * GE_latency
'Give GE a chance to digest it
Call Make_DoEvents
'Get Temporary Places folder
Set GE_interface_temp_places_folder = GE_interface.GetTemporaryPlaces
'Get Temporary Places folder contents
Set GE_interface_temp_places_collection = GE_interface_temp_places_folder.GetChildren
'For each item in Temporary Places folder...
For i% = 1 To GE_interface_temp_places_collection.Count
'Get Temporary Places folder item
Set GE_interface_temp_places_child = GE_interface_temp_places_collection.Item(i%)
'If kml file internal name found in Temporary Places folder...
If GE_interface_temp_places_child.Name = Internal_name Then
'Flag kml file found
kml_found% = True
'Quit loop
Exit For
End If
Next
'If kml file internal name has appeared in or disappeared from Temporary
'Places folder (as flagged by Accept_state)...
If kml_found% = Accept_state Then
'Flag acceptance wait has been successful
GE_Send_Kml = True
'Quit loop
Exit Do
End If
Loop