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