Community of MapPoint and Virtual Earth Users and Developers
This is a discussion on Can a MapPoint control be conditionall loaded or late bound? within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Greetings, all. I have an application which is using the MapPoint control for doing some routing. It works very well. ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Can a MapPoint control be conditionall loaded or late bound? I have an application which is using the MapPoint control for doing some routing. It works very well. The issue is an Access Violation is raised when the application is launched on a machine on which MapPoint isn't installed. Is there a way to verify that MapPoint is, in fact, installed and then instantiate the control? I really don't want to have to maintain two versions of this application! FWIW, the app is written in Delphi. Phil Frank |
| |||
| Re: Can a MapPoint control be conditionall loaded...
Hello, I successfully used this in VB 6. (MyRegistry is my class to read Registry keys, you can try something similar...) ------------------------------------------------- Code: Private Function TestMapPointInstallation(sVersion As String, sRegion As String) As Boolean
Dim bOK As Boolean
Dim sKey As String
Dim sPath As String
Dim aRegistry As New MyRegistry
Dim d As Drive
sKey = "Software\Microsoft\MapPoint\" & sVersion & "\" & sRegion
bOK = aRegistry.ReadKey(HKEY_CURRENT_USER, sKey, "InstallTo", sPath)
If Not bOK Then
Exit Function
End If
sPath = sPath & "Data\" & sRegion & "_CD.mad"
bOK = g_TheFso.FileExists(sPath)
If Not bOK Then
bOK = aRegistry.ReadKey(HKEY_CURRENT_USER, sKey, "DataPath", sPath)
If Not bOK Then
Exit Function
End If
sPath = sPath & "\" & sRegion & "_CD.mad"
bOK = g_TheFso.FileExists(sPath)
If Not bOK Then
For Each d In g_TheFso.Drives
If d.DriveType = CDRom Or d.DriveType = Remote Then
sPath = d.DriveLetter & Right(sPath, Len(sPath) - 1)
bOK = g_TheFso.FileExists(sPath)
If bOK Then
Exit For
End If
End If
Next
End If
End If
g_bMapPointInstallationOK = bOK
TestMapPointInstallation = bOK
End Function
Public Function InitializeMapPointControl() As Boolean
Dim bOK As Boolean
If g_bMapPointInstallationTested Then
bOK = g_bMapPointInstallationOK
Else
g_nMapPointVersion = 11
bOK = TestMapPointInstallation(CStr(g_nMapPointVersion) & ".0", "EUR")
If Not bOK Then
g_nMapPointVersion = 9
bOK = TestMapPointInstallation(CStr(g_nMapPointVersion) & ".0", "EUR")
End If
g_bMapPointInstallationTested = True
End If
If Not bOK Then
GoTo EH
End If
On Error Resume Next
Licenses.Add "MapPoint.Control." & g_nMapPointVersion
On Error GoTo EH
Set theMapPoint = Controls.Add("MapPoint.Control." & g_nMapPointVersion, "theMapPoint", Me)
' Move the control where you want...
theMapPoint.Move 0, 0, Width, Height
theMapPoint.Visible = True
theMapPoint.NewMap geoMapEurope
InitializeMapPointControl = True
EH:
End Function
|
![]() |
| Tags |
| bound, conditionall, control, late, loaded, mappoint |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: Keyboard control in mappoint activex control | djcapslock | MapPoint 2006/2009 Discussion | 1 | 03-10-2005 10:16 AM |
| Using MapPoint Control for Web App | Attila | MapPoint 2006/2009 Discussion | 1 | 01-11-2005 09:36 AM |
| i need the mappoint control 9 please | Anonymous | MapPoint 2006/2009 Discussion | 3 | 04-22-2004 09:41 AM |
| disable loaded pin sets in mappoint 2002 | Anonymous | MapPoint 2006/2009 Discussion | 1 | 04-22-2003 08:52 PM |
| I am using MapPoint Control in another Ac.... | Anonymous | MapPoint 2006/2009 Discussion | 1 | 11-23-2001 08:29 AM |
Algarve Holiday
Portuguese all year round sunshine is some of what awaits you if you choose the Algarve holiday option through UlookUbook!