Community of VE/MapPoint 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. ...
| |||||||
| 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 |
Cheap flights to Naples
The Neapolitan Riviera is the home of pizza and with cheap flights to Naples it can be the home of your holiday too. Book with Holiday Hypermarket.
Spain Weather
Check out Spain Weather - Travel Counsellors details information on Spain including, weather, flights and accommodation.
Holiday in Portugal
A holiday in Portugal is low cost but great value when you book with us online. Transportation and accommodation are excellent and very reasonable too.
Mauritius Holidays
Mauritis holidays are a sun drenched, sense tingling experience of a lifetime. You will find bargain deals on many holidays with us!
Canaries
Find out all about the Canaries when you check out the ulookubook.com travel guides. Not only can you get a great holiday deal but you can find out useful information about potential holiday destinations.
Holidays
At Travel.co.uk the options for holidays are endless. Do some online comparison shopping!
Cheap Holidays to Sharm el Sheikh
Break away to Northern Africa. Find cheap holidays to Sharm el Sheikh at On The Beach.