MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Can a MapPoint control be conditionall loaded or late bound?

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. ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-24-2004
Junior Member
White Belt
 
Join Date: Dec 2003
Posts: 8
Can a MapPoint control be conditionall loaded or late bound?

Greetings, all.

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2004
Junior Member
White Belt
 
Join Date: Dec 2003
Posts: 8
Stefano:

Thanks for your code sample. When I finally get this to work I'll give you a credit for this part of the application.

Phil Frank
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
bound, conditionall, control, late, loaded, mappoint


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

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


All times are GMT -5. The time now is 01:33 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52