| Re: Problem calling AddPolyline in C++
This is from one of my mapping integration applications: Quote:
/*
Sweet Jesus this was a pain in the ass to get right.
MapPoint doesn't want a typical variant array of integers,
rather it wants a variant array of variant objects, with
each variant object holding an integer.
Without this indirection, MapPoint simply throws the
dreaded "The parameter is incorrect" error message.
*/
VARIANT larray_to_varray(long la[], long size = 5) {
#pragma warning(disable: 4267)
#pragma warning(disable: 4018)
COleSafeArray varArray;
DWORD elements[] = { size };
varArray.Create(VT_VARIANT, 1, elements);
for (long i = 0; i < size; i++) {
_variant_t v(la[i]);
varArray.PutElement(&i, &v);
}
return varArray.Detach();
}
|
Last edited by Eric Frost; 08-12-2008 at 03:02 PM.
Reason: remove offending smilie
|