Community of MapPoint and Virtual Earth 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 ...
| |||||||
| Today's Posts | Twitter Feed | 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; 08-12-2008 at 02:02 PM.. Reason: remove offending smilie |
![]() |
| Tags |
| addpolyline, calling, problem |
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 |
Madeira Holiday
Why not book a Madeira holiday through UlookUbook and enjoy this warm Portuguese island at a bargain price!
Pubs...
Pubs can be noisy, cozy, friendly or awful. The helpful network of customer reviews will help you pick a nice one.