MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




MapPoint 2004 and Delphi 5

This is a discussion on MapPoint 2004 and Delphi 5 within the MapPoint 2006/2009 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: ...


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 10-22-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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.
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 10-27-2004
Member
Green Belt
 
Join Date: Nov 2002
Posts: 52
Have a try with FMAP:=NIL when closing the application

Rainer
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 10-29-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 12-05-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 12-07-2004
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,112
Hi,

maybe it is the olecontainer?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 12-14-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
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);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 01-20-2005
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Re: My Solution

Code:
FMap := nil;
OleContainer1.DestroyObject;
Make sure all variables gained from the FMap are also nil'd after use...
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
delphi, mappoint 2004


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


All times are GMT -5. The time now is 03:20 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


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