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 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Cannot CreateObject("MapPoint.Application")

This is a discussion on Cannot CreateObject("MapPoint.Application") within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi Sharoma, I was hoping I could open your project with VS2005, but it is not. However I made new ...

  1. #11
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi Sharoma,

    I was hoping I could open your project with VS2005, but it is not. However I made new application in VB and copy the relevant part to see what happen. I only changed filenames and made the application visible to see if it works.

    The only thing I had to do was add the type library to the project, however VS do not show me that it is added (but I dont know mutch of VB). Anyway this peace of code works here:

    Code:
    Public Class Form1
    
        Private MyMap As MapPoint.Map
        Dim objApp As MapPoint.Application
    
        Private Sub UserControl_Initialize()
            On Error Resume Next
            objApp = GetObject(, "MapPoint.Application")
            If objApp Is Nothing Then
                objApp = CreateObject("MapPoint.Application")
                MyMap = objApp.OpenMap("C:\Program Files\Microsoft MapPoint Europe\MP2004\Samples\Sales.ptm", False)
                If (MyMap Is Nothing) Then
                    MyMap = objApp.NewMap()
                End If
            Else
                MyMap = objApp.ActiveMap
                If MyMap Is Nothing Then
                    MyMap = objApp.OpenMap("C:\Program Files\Microsoft MapPoint Europe\MP2004\Samples\Sales.ptm", False)
                    If (MyMap Is Nothing) Then
                        MyMap = objApp.NewMap()
                    End If
                End If
            End If
    
            'objApp.Visible = False
            objApp.Visible = True
            objApp.UserControl = True
            objApp.Activate()
    
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            UserControl_Initialize()
        End Sub
    End Class
    I also see that your project is containing an *.ocx with same name as *.ctl file. And then the function name 'UserControl_..'. Maybe this has something to do with the error ?

    Maybe other people with better knowledge of VB than me can answer here ?

  2. #12
    sharoma is offline Junior Member White Belt
    Join Date
    Oct 2006
    Posts
    8
    Thanks
    Looking at the line ===> MyMap = objApp.OpenMap("C:\Program Files\Microsoft MapPoint Europe\MP2004\Samples\Sales.ptm", False)

    I hope you were using MP2006 and not MP2004.

    As my project works fine with MP2004 but not with MP2006.

  3. #13
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    I forgot this. But just did the same test with MP2006. Same result it run here. I will email the project back together with the executable. Let's see if it run there.

  4. #14
    sharoma is offline Junior Member White Belt
    Join Date
    Oct 2006
    Posts
    8
    Hi Wilfried, Unfortunately I only have two options for running the software.
    (a) VB6 w/sp5
    (b) VS2003

    When I tried your above code sample in VS2003 it failed to run in MP2006 however it ran fine in MP2004.

    This makes me think if there is an compatibility issue wrt MP2006 and VB6/VS2003

  5. #15
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi Sharoma,

    It should work because you are using the type library. But I'm a little out of ideas now.

    Did you try the executable I sent you together with my project ? Does it run on both mappoint versions ?

  6. #16
    sharoma is offline Junior Member White Belt
    Join Date
    Oct 2006
    Posts
    8
    I cannot run your Application as it requires .NET 2. Where as I only have VS.NET2003

    However your earlier sample project code works okay in MP2004 but not in MP2006

  7. #17
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi Sharoma,

    Still we are not sure if it is something on your machine or with a VS2003 / VB6 setting. If you want you may send me an *.exe then I try it with MP2004 and then with MP2006 registeres.

    If this works here then we know it is not VB/VS setting. Unless someone has a better idea ?

  8. #18
    cwrude is offline Junior Member Yellow Belt
    Join Date
    Nov 2004
    Posts
    19

    Re: Cannot CreateObject("MapPoint.Application")

    We experienced the same problem with some users who had been running an earlier version of MapPoint (2002 or 2004) on their PC, and then installed MapPoint 2006. After spending some time with Microsoft techs, the problem was discovered to be permissions-related. The solution was as follows:

    1. Using RegEdit, change the permissions on HKEY_CLASSES_ROOT\.ptm and HKEY_CLASSES_ROOT\.ptt to Full Access for the Administrator. (to do this, right-click on the .ptm folder under HKEY_CLASSES_ROOT and select "permissions")

    2. From command prompt, reregistered MapPoint using the command "C:\Program Files\Microsoft MapPoint\MapPoint.exe" /regserver.

    The Microsoft tech said that he has seen this more than a few times with users running MP2006 who had previously been running an earlier version. He says that they are checking to see if this is, in fact, a bug with the MP2006 install routine. Good luck!

  9. #19
    AUR
    AUR is offline Junior Member White Belt
    Join Date
    Dec 2006
    Posts
    11

    Unhappy Re: Cannot CreateObject("MapPoint.Application")

    Hi

    There is no object in his control,

    This is the message i used to receive in Access2003/VBA form integrated with MP2004 whenever i closed the form either manually or programmatically.

    The form is working fine with all mappoint functionality, but i've to place the control again on the form.

    This normally occurs when ur OCX control isnt displayed in the ACtive Xcontrols list, however its still there and i'm now stuck why it happens.

    Any help would be greatly appreciated.
    many thanks.
    AUR

  10. #20
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: Cannot CreateObject("MapPoint.Application")

    Hi,

    You cannot create object 'mappoint application' in parallel with the activeX control on a form.

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. MapPoint 2004 Active-X control: how to "bump" pus
    By citrix_99301 in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 03-18-2006, 03:50 AM
  2. Mappoint exception "Call was rejected by callee"
    By jliao81 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-03-2005, 08:53 AM
  3. Do I need "Autoroute Europe", if I install "M
    By bigtail in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-24-2004, 12:58 AM
  4. MapPoint "Fleet Application" definition
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 08-26-2003, 03:16 PM
  5. "Microsoft Mappoint" writing and Pushpin Highligth
    By feanor in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 03-12-2003, 05:47 AM

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 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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96