MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




MapPoint 2006 with ActiveX

This is a discussion on MapPoint 2006 with ActiveX within the MapPoint 2006/2009 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 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (5) Thread Tools Display Modes
  5 links from elsewhere to this Post. Click to view. #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
Posts: 2,094
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


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/mappoint-2006-activex-6115.html

Posted By For Type Date
AxImp: Blogs, Photos, Videos and more on Technorati This thread Refback 09-22-2007 07:50 AM
Microsoft MapPoint 2006 - MP2K Magazine This thread Refback 08-03-2007 10:32 PM
Working With Excel and MapPoint - MP2K Magazine This thread Refback 08-02-2007 02:23 AM
MapPoint Help - MP2K Magazine This thread Refback 08-01-2007 05:06 PM
Building an Animated Map with Flash Demo Builder - MapPoint Articles - MP2K Magazine This thread Refback 07-31-2007 12:45 PM

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


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

Ski Deals
Book first-rate ski holidays from the leading travel brands at exceptionally competitive prices. Check out the latest range of ski deal online at Holiday Hypermarket.

Home Based Travel Agent
Book your travel through a Home Based Travel agent. Travel Counsellors are a Queen's Award winning Travel Agent.

Holidays in Italy
Holidays in Italy boast some stunning countryside as well as a beautiful coastline. You can even visit an active volcano like Stromboli or Etna. Book at dealchecker.co.uk.

Holidays to Bahamas
Choose from a number of extraordinary holidays to the Bahamas at The Holiday Place. See pictures of these beautiful islands online.

Canaries
Find out all about the Canaries when you check out the ulookubook.com travel guides. Not only can you get a great holiday deal but you can find out useful information about potential holiday destinations.

Compare flight prices
Travel.co.uk makes it easy for you to compare flight prices from hundreds of UK based travel companies.

Cheap holidays in Cyprus
Stunning coastline! Beautiful beaches! Cheap holidays in Cyprus, available at On The Beach.


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