Community of VE/MapPoint Users and Developers
This is a discussion on Problem calling AddPolyline in C++ within the Development forums, part of the MapPoint 2006/2009 Discussion category; I'm using Variants for calling MapPoint functions and I'm having all kind of problems when calling the AddPolyline function. Basically ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Problem calling AddPolyline in C++ Basically I create a SafeArray where I store all the locations (2 for this example) and after that I call the AddPolyline function with that array. When I make that call the program crashes. Anybody has any idea where it may be the problem? Thanks Code: Variant oMap;
Variant oApp;
OleContainer->Visible = false;
OleContainer->DestroyObject();
OleContainer->CreateObject("MapPoint.Map",false);
oMap = OleContainer->OleObject;
oApp = oMap.Exec (PropertyGet("Application"));
SAFEARRAY *pSA;
SAFEARRAYBOUND aDim[1]; // a one dimensional array
aDim[0].lLbound= 0;
aDim[0].cElements= 2;
pSA= SafeArrayCreate(VT_VARIANT,1,aDim); // create a 1D SafeArray of VARIANTS
HRESULT hr= S_OK;
if (pSA != NULL)
{
long aLong[1];
for (long i= aDim[0].lLbound; i< (aDim[0].cElements + aDim[0].lLbound); i++)
{
Variant oloc = oMap.Exec ( Function("GetLocation") << 38.8186 << -77.1361 << 0.1 );
aLong[0]= i;
if (hr == SafeArrayPutElement(pSA, aLong, &oloc))
{
int a=5;
}
}
}
VARIANT v;
VariantInit(&v);
v.vt = VT_BYREF|VT_ARRAY;
// v.pparray = &pSA;
v.parray = pSA;
Variant myShapes2 = oMap.Exec(PropertyGet("Shapes"));
myShapes2.Exec ( Function("AddPolyline") << v );
OleContainer->Visible = true;
OleContainer->DoVerb(ovShow);
|
| |||
| Re: Problem calling AddPolyline in C++
Hi, Can you tell us what you mean by 'crash'? Do you have an error or exception error? What is the error or error message?
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: Problem calling AddPolyline in C++ Quote:
Thanks for your reply. I get an error that says 'The parameter is incorrect' |
| |||
| Re: Problem calling AddPolyline in C++
Hi, I'm not sure. But you put the address of oLoc to the array (&oLoc), I'm not sure this is correct. Also can you test if oLoc is valid Location? You can do this for example by placing a pushpin with the same oLoc or so.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: Problem calling AddPolyline in C++
This is from one of my mapping integration applications: Quote:
Last edited by Eric Frost; 2 Weeks Ago at 02:02 PM. Reason: remove offending smilie |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do I use AddPolyline method in Delphi | stephenmillington | Development | 4 | 09-20-2007 12:52 PM |
| Addpolyline from a dataset | micheln | MapPoint 2006/2009 Discussion | 3 | 05-04-2007 06:49 AM |
| AddPolyLine (s) array problem | FreddyD | MapPoint 2006/2009 Discussion | 1 | 12-20-2006 12:45 PM |
| Shapes.AddPolyline is very slow | tdaffin | MapPoint 2006/2009 Discussion | 4 | 01-27-2006 07:08 AM |
| addpolyline | Anonymous | Wish List | 2 | 04-25-2003 03:50 PM |
Ski Holidays Andorra
Ski holidays in Andorra offer value for money right across the board. Clothes, meals and accommodation are great value with duty free prices. Book great value ski holidays today.
City Break Europe
Take a city break in Europe. Travel Counsellors can help plan and book your European city break.
Holidays to Cuba
Situated between Jamaica and the Bahamas, Cuba has a delightful tropical climate and warm, clear waters with beaches of white sand. Check for cheap holidays to Cuba.
Holidays to Jamaica
Holidays to Jamaica are about taking things easy. Forget your watch and chill out beneath the clear Jamaican sky.
Cheap Morocco Holidays
Cheap Morocco holidays may be the answer to your cheap holiday search. With sunshine throughout most of the year it can be great value if you avoid the peak season. Why not include a trip to the small tranquil town of Chefchaouen Tangier in your visit?
Compare Prices
Travel.co.uk makes it easy for you to compare prices from hundreds of UK based travel companies.
Holidays in Fuerteventura
Need a break? Go to the Canary Islands! Find information on holidays in Fuerteventura at On The Beach.