MapPoint Forums

MapForums

Community of MapPoint and Bing Maps Users and Developers




MapPoint 2006 with ActiveX

This is a discussion on MapPoint 2006 with ActiveX within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, i'm using c#.net, i made a wrapper for the ocx Visual Studio prompt: aximp <ocx-file> /source /keyfile:<key-file> the key ...


Go Back   MapPoint Forums > Map Forums > MapPoint Desktop Discussion

Today's Posts Twitter Feed Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-31-2007
Member
Yellow Belt
 
Join Date: Jul 2007
Posts: 45
MapPoint 2006 with ActiveX

Hi,
i'm using c#.net, i made a wrapper for the ocx
Visual Studio prompt:
aximp <ocx-file> /source /keyfile:<key-file>
the key doesn't matter, output are two files
1. AxMapPoint.dll
2. MapPoint.dll
First i got the Problem that the ActiveX needed
a parent

using AxMapPoint;

AxMappointControl mapPoint = new AxMappointControl();
form1.Controls.Add(mapPoint);
mapPoint.NewMap(2);

if you use something like this on a simple Form it's no problem.

I made a class for using the Control and want to
use it for calculation even without displaying.
i got a form, simply said MyForm form1 = MyForm()
then i give the ControlCollection of the Form.Panel to the Class
an do following things (ControlCollection controls):

AxMappointControl mapPoint = new AxMappointControl();
controls.Add(mapPoint);
mapPoint.NewMap(2);
...
form1.Show(); //not in the class, just to show that i try to display
the form afterwards

On the NewMap() Operation it bangs.
Little bit of testing showed that if i make the Form Visible and
do Operations like NewMap and Calculate everything works
finy, but as soon as the form isn't visible no Operation works.
It's not the problem that something crashs but i want to
calculate distances of Routes even without displaying.

Additional:
First i used an Activator to call MapPoint.Application.EU.13
and did InvokeMember calls to use it, calculation and
everything works fine, but i can't display it. 2 Ways of doing
things for each part but they don't work together. I read
about the object model but in c#.net there is just a
Application interface, can't figure it out how this should work.
I think that i use the object model with the Activator but
little do i know ^^.

(can't paste the whole code because of interfaces, factory
and other stuff that i need for the project to make
mappoint an optional part, but the problem is quite simple)

I would like to use the OCX without displaying the Form
but can't find a solution. Thanks for help.
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 07-31-2007
Member
Yellow Belt
 
Join Date: Jul 2007
Posts: 45
Re: MapPoint 2006 with ActiveX

Oh, btw, if you need code of the Activator part etc. just post a request here.
(maybe enriches the forum)
It's just the problem that i need Late Binding for this project, but it works
somehow, just the control struggles. And the helpfiles aren't very helpfull.
Most parts are in VB and things you can't use in c#.
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 08-01-2007
Member
Yellow Belt
 
Join Date: Jul 2007
Posts: 45
Thumbs up Re: MapPoint 2006 with ActiveX

Hi there, no, i won't write "I got the solution, thanks, bye".

The problem was that the activeX wasn't completly
initialized, in which way ever the show method of the
form called the EndInit() Method of the ActiveX and made
the usage afterwards possible.

Solution: Just call it yourself.
Form myForm = new Form();
AxMappointControl mapPoint = new AxMappointControl();
myForm.Controls.Add(mapPoint);
mapPoint.EndInit(); // <- That's the way
mapPoint.NewMap(MapPoint.GeoMapRegion.geoMapEurope );
myForm.Show();

Sry for my bad and irritating english, i'm german an not quite
used to write or talk in english. Hope this helps some of you.
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 08-04-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Location: Belgium
Posts: 2,389
Re: MapPoint 2006 with ActiveX

Hi,

I should work without the endInit(). Here I use an existing control. Maybe that is the reason:

Code:
public SnapToRoad(Control Owner, GeoMapRegion mapRegion)
{
    owner = Owner;
    mp = new AxMapPoint.AxMappointControl();
    owner = Owner;
    owner.Controls.Add(mp);
    mp.NewMap(mapRegion);
    map = mp.ActiveMap;
}
Dont forget to destroy it when you don't need it anymore:

Code:
~SnapToRoad()
{
    Dispose(false);
}

public void Dispose()
{
    Dispose(true);
    GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposeManagedResources)
{
    if (!disposed) {
	if (disposeManagedResources) {
	    map.Saved = true;
	    owner.Controls.Remove(mp);
	    mp.Dispose();
	    mp = null;
	    map = null;
	}
	disposed = true;
    }
}
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 08-10-2007
Member
Yellow Belt
 
Join Date: Jul 2007
Posts: 45
Re: MapPoint 2006 with ActiveX

Absolutely right, but activex wrapper and such stuff...
if you have the problem, just do the above, normal
usage won't need it ... but if you use it different the
control will bite you
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
activex, mappoint 2006


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
VC++ doesn't find MapPoint 2006 ActiveX control DrNobody MapPoint Desktop Discussion 3 02-22-2007 09:41 AM
Mappoint 2006 ActiveX Questions ben_dillon MapPoint Desktop Discussion 3 01-31-2007 06:16 AM
FInd center location of ZipCode area using MP ActiveX (MP 2006) Ekas MapPoint Desktop Discussion 2 01-26-2007 09:46 AM
Difference between MapPoint 2006 and MapPoint 2006 Fleet jlewis MapPoint Desktop Discussion 1 11-21-2006 08:18 AM
mapPoint 2006 activex control slow down form closing bule MapPoint Desktop Discussion 1 09-26-2006 01:22 PM


All times are GMT -5. The time now is 04:54 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.0 RC3
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69