MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Mappoint and a .Net Console App

This is a discussion on Mappoint and a .Net Console App within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; I am trying to use Mappoint in a .Net Console app. I don't need to see the map, I just ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-03-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Mappoint and a .Net Console App

I am trying to use Mappoint in a .Net Console app. I don't need to see the map, I just need mileage.

This is what I have

Dim objMap As New AxMapPoint.AxMappointControl()
objMap.NewMap(MapPoint.GeoMapRegion.geoMapNorthAme rica)

The latter command errors immediately with the following message:

"Exception of type InvalidActiveXStateException was thrown."

I have no other Mappoint related statements before this point.
Anyone have any thoughts on that?
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 09-03-2004
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,304
Blog Entries: 1
There's several .Net / MapPoint desktop apps on this website, I think the simplest and most relevant to your inquiry might be:

http://www.mp2kmag.com/a69--automate....mappoint.html

Hope this helps!

Eric
__________________
~ Now taking orders for MapPoint 2009 ~
~
~ Upgrade to MapForums Plus membership ~
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 09-04-2004
EdB EdB is offline
Member
Green Belt
 
Join Date: Aug 2002
Posts: 56
Eric,

I appreciate the response. I was able to get my situation to work by adding a windows form to my console app, adding a Mappoint control to that form, and just never showing the form.

But I wanted to to try your solution. Did someone just write that, or did they actually try it? Here's why I ask. When I copy and paste the solution as is, I get several compile errors. 6 with the project setting "Strict" on (which I normally use), and 3 with it off. Here are the errors.

1&2) Dim WithEvents oMpApp As MapPoint.Application
Dim WithEvents oMap As MapPoint.Map

Withevents variable does not raise any events

3,5&6) oMpApp = GetObject(, "MapPoint.Application")
myLoc = oMap.FindAddressResults(, , , states(I), , "USA")(1)
oMap.SaveAs(states(I), 2)


Option Strict On disallows implicit conversions from 'System.Object' to 'MapPoint.Application'

4) oMpApp = New MapPoint.Application()

'New' cannot be used on an interface.

I can get around the other 5......I don't know how to get around this one.


Ed
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 09-04-2004
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,304
Blog Entries: 1
Hmm, yeah I had no problems with it. I used it with the free command-line tools the .NET SDK, not VS.NET.

Eric
__________________
~ Now taking orders for MapPoint 2009 ~
~
~ Upgrade to MapForums Plus membership ~
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 09-06-2004
Junior Member
White Belt
 
Join Date: Aug 2004
Posts: 6
I second EdBick's situation as I am getting the same error when trying to use New on MapPoint.Application.

I had to resort to CreateObject() function to get around this problem, which is inconsistent with many MapPoint samples out there.

The other strange problem I couldn't resolve is why GetPictureFromObject() always returns some default map of the North-Western US region even if the actual map is totally different (and yes, I have saved it before calling GetPictureFromObject()).

Alex
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


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


All times are GMT -5. The time now is 08:22 AM.


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

Cheap Flights Paphos
Have a fantastic holiday in Paphos. Enjoy the lively seafront atmosphere and the picturesque mediaeval port. Book cheap flights online at Holiday Hypermarket.

City Breaks
Top 10 City Breaks . Based on holidays booked this year, these are the most popular City Breaks for 2006

Holiday Italy
A Holiday in Italy can mean many different things to many different people. This diverse country has an abundance of art, wine, food and stunning beaches. Book online today.

Bahamas Holidays
Bahamas Holidays offer pure blue skies, soft white beaches and the holiday of a lifetime. Visit us for a great deal to the Bahamas.

Portugal
As well as providing some great weather Portugal has much to offer culturally. There are numerous museums, monuments and places of historical interest to explore. Despite the rich history there is a buzzing nightlife and great shopping too.

Package Holidays
With the help of Travel.co.uk you can find the package holidays of your dreams.

Holidays to Gran Canaria
The Canary Islands await! Book holidays to Gran Canaria online 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