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
Results 1 to 7 of 7

MapPoint 2004 and Delphi 5

This is a discussion on MapPoint 2004 and Delphi 5 within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi there, I'm using MP2004 in delphi 5. My application uses an OleContainer that initialise MP 2004 in this way: ...

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

    MapPoint 2004 and Delphi 5

    Hi there,
    I'm using MP2004 in delphi 5. My application uses an OleContainer that initialise MP 2004 in this way:

    OleContainer1.CreateObject('MapPoint.Map.EU.11', False);
    OleContainer1.DoVerb(ovPrimary);
    OleContainer1.OleObjectInterface.GetUserClassID(vG uid);
    FMap := IDispatch(OleContainer1.OleObject) as _Map;

    In the main form i introduce some components like textbox, buttons, Memo etc. and several times, when I shutdown the application, I have this message:

    "Project1 has raised exception class EAccessViolation with message ' Access Violation at address 77ADCA82 in module "ole32.dll". Read of Address 00C2762C'. Process Stopped. Use Step or Run to Continue."

    The addresses are the same everytime the exception comes up.

    When I insert new buttons or textbox the exception raises; when I remove the new components the Exception does not raise.

    It's very strange; could someone help me?

    Thanks in advance.

  2. #2
    rbarthels is offline Member Green Belt
    Join Date
    Nov 2002
    Posts
    52
    Have a try with FMAP:=NIL when closing the application

    Rainer

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

    MapPoint and D5

    I tried to set FMAP := nil in the "OnClose" event of the main form but nothing changes.

    For example: I inserted a TCustomWinSocket component on the form and the exception raised up. When removed the component the exception did not raise.

    Could it be the OLE container?

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

    exception olecontainer + winsock

    yeah, i have the same problem in c++ builder 6.

    i have a form with mappoint running in a olecontainer. opening and closing the complete application works without any error.

    when i add a winsock component to the form, i get an exception after closing the form. when i remove the winsock component, everything seems to be OK.

    what is going on here?

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

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

    My Solution

    I think this is something to do with components notifying each other when they are freed. The form is the owner of components that are created automatically and, as far as I can remember, when each component on the form is freed every other component on the form is notified. I think the ActiveX object might not be able to cope with knowing about components in the application being freed.

    My solution was to create the TOLEContainer at run time and set its owner to its parent. This stopped the access violations.

    My code for doing this was:
    Code:
        OleContainer := TOleContainer.Create(PMap); //PMap is a panel
        OleContainer.Parent := PMap;
        OleContainer.Align := alClient;
        OleContainer.CreateObject('MapPoint.Map.EU', False);

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

    Re: My Solution

    Code:
    FMap := nil;
    OleContainer1.DestroyObject;
    Make sure all variables gained from the FMap are also nil'd after use...

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Mappoint 2004 ActiveX Delphi 2005 How to add a Polyline
    By it-fraggel in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 04-04-2006, 02:23 PM
  2. Using MapPoint In Delphi
    By Anonymous in forum MP2K Magazine Articles
    Replies: 8
    Last Post: 12-05-2005, 10:51 AM
  3. Mappoint 2004 Control in Delphi
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 10-02-2003, 04:55 PM
  4. How to get mappoint Active X in Delphi?
    By jmiller55 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 07-31-2003, 10:54 PM
  5. Mappoint With Delphi 5
    By stuarth in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 04-08-2003, 11:21 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 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