Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Page 1 of 5 123 ... LastLast
Results 1 to 10 of 44

Access some hidden features in MapPoint2002 ActiveX control

This is a discussion on Access some hidden features in MapPoint2002 ActiveX control within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, An example project under the link below shows a technique (using WinAPI) to access MapPoint2002 functionality (like 'Location Sensor' ...

  1. #1
    baal_2000's Avatar
    baal_2000 is offline Junior Member Yellow Belt
    Join Date
    Jan 2003
    Location
    Toronto, ON, Canada
    Posts
    24

    Access some hidden features in MapPoint2002 ActiveX control

    Hi,

    An example project under the link below shows a technique (using
    WinAPI) to access MapPoint2002 functionality (like 'Location Sensor' or
    'Measure Distance' from 'Tools' menu), which is not readily available in
    the ActiveX control.

    Download:
    http://www3.sympatico.ca/spavlov/mappoint_extended.zip

    The code is not well documented and does not pretend to be bug-free.
    But, it is not too complex to understand.

    Ones who are interested in the technique employed to extend the MapPoint ActiveX
    functionality, read the article here: http://www.mp2kmag.com/articles.asp?ArticleID=88

    I appreciate responses, fixes as well as reports about new functionality
    been accessed and not present in the posted example.

    Thank you,

    Sergiy Pavlov

  2. #2
    blackmap is offline Member Yellow Belt
    Join Date
    Dec 2002
    Posts
    39
    Hi ,

    just downloaded the extented .zip.
    Wonderful things happening here.

    You did that great!

    As I am new to VB and MapPoint I have some problems
    integrating your code into mine:

    First: With the MapPoint.cls I have name-conflict. I changed that module to mapoin and pasted the code into.

    First I want to include that location sensor.
    With

    objMap.DragBehavior = MapPointSupport.geoDragLocationSensor

    you call that function. And here's where I get an error saying no such objet existing (got a german version). Do have an idea what's the problem?


    Thanks a lot

    Peter

  3. #3
    baal_2000's Avatar
    baal_2000 is offline Junior Member Yellow Belt
    Join Date
    Jan 2003
    Location
    Toronto, ON, Canada
    Posts
    24
    Peter:

    check if you created an instance of objMap BEFORE accessing its property.
    You shoould have "Set objMap = New MapPoint" (or whatever the name of the class) somewhere in the code.

    Sergiy

  4. #4
    blackmap is offline Member Yellow Belt
    Join Date
    Dec 2002
    Posts
    39
    Hi Sergiy,

    I still do have the name-conflict. I changed the classmodule mappoint to mappoin, did the

    Set objMap = New MapPoin

    had a problem with the moPan, commented it and... the location sensor is working now!

    Thanks a lot!

    Peter

  5. #5
    dzhong is offline Member Yellow Belt
    Join Date
    Aug 2002
    Posts
    45
    Hi,

    I tried to port your code into my application and want to use the "print" feature. However I got "Run time error 91 -- Object variable or with block object not set" with the following code line:

    Private Property Get hWnd_Frame() As Long
    Dim TWnd As New TWindow

    TWnd.hWnd = frmMain.hWnd
    TWnd.hWnd = TWnd.FindChildWindowByClass("ATL:", False).hWnd '******Problem occured here**********
    If Mid$(TWnd.ClassName, 9, 4) = "2748" Then
    TWnd.hWnd = TWnd.FindChildWindowByClass("ATL:", False).hWnd
    If Mid$(TWnd.ClassName, 9, 4) = "2070" Then
    TWnd.hWnd = TWnd.FindChildWindowByClass("AfxFrameOrView42").hW nd
    hWnd_Frame = TWnd.hWnd
    End If
    End If

    End Property

    I did set:

    Set obiMap = New MapPoint
    Set Map = frmMain.MappointControl.Activemap

    before I call

    objMap.SendCommand MapPointMenu.mnuFile.cmdPrint

    Do you have any clues? Any suggestions are appreciated very much!

    Thanks,

  6. #6
    baal_2000's Avatar
    baal_2000 is offline Junior Member Yellow Belt
    Join Date
    Jan 2003
    Location
    Toronto, ON, Canada
    Posts
    24
    David:

    What is Windows version your app runs on?
    And did the error happen in the original example application?

    I've recently found that on some Win98 systems TWindow.FindChildWindow method fails.

    It does not happen when a piece of code
    in TWindow.FindChildWindow is changed:


    If Not TWin.Valid Then
    Set TWin = Nothing
    End If


    To


    If TWin.hWnd = 0 Then
    Set TWin = Nothing
    End If


    Try it out!
    Sergiy

  7. #7
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    Sergiy,

    thank you very much for your quick reply.
    No luck to get it work. My OS is Windows 2000.
    Your original example version works fine.
    The only differences is my main form (renamed as frmMain) is much more complicate than yours.

    By the way, can you bring up the "More options..." screen of the route planner by using the similar method. I'd like to bring up the screen just by clicking a button, but not on the route planner screen.

    Thanks again,

    David

  8. #8
    Anonymous is offline Senior Member Black Belt
    Join Date
    Jul 2002
    Posts
    5,137
    The problem is that my program will go through the code

    If Not TWin.Valid Then
    Set TWin = Nothing
    End If

    Then no object is set for TWin.

    Any clues?

    Thanks,

  9. #9
    baal_2000's Avatar
    baal_2000 is offline Junior Member Yellow Belt
    Join Date
    Jan 2003
    Location
    Toronto, ON, Canada
    Posts
    24
    David,

    I would suggest that your MapPoint control was not placed directly on your frmMain but rather on some kind of a frame window.

    If the container frame name is 'Frame1', for instance, then inside 'Property Get hWnd_Frame' use that object name 'frmMain.Frame1' in place of 'frmMain'.

    If it is not your case, and there is indeed an unknown problem with frmMain complexity, then resolve it by creating such a frame (specifically designated to contain MapPoint control in it). Cut and paste MapPoint on the frame and point ''Property Get hWnd_Frame' to it as discussed above.

    Hope this should help,
    Sergiy

  10. #10
    dzhong is offline Member Yellow Belt
    Join Date
    Aug 2002
    Posts
    45
    Sergiy,

    thank you very much for your recognization of the problem. You are right, the Mappoint is not on the form directly.

    I will try it out following your instruction.

    Can you bring up the Window for routing preference by using a similar way? My application wants to set the parameters at the system configuration phase.

    David

Page 1 of 5 123 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. MS Access Mappoint ActiveX
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 05-21-2005, 06:31 PM
  2. Re: Keyboard control in mappoint activex control
    By djcapslock in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-10-2005, 11:16 AM
  3. MS Access and Mappoint ActiveX Control
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 06-26-2004, 02:29 PM
  4. Using MP ActiveX Control in Access/Foxpro etc
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 02-21-2003, 12:51 PM
  5. Hi EB Can i use the Map point control features ....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 05-14-2002, 03:03 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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