MapWinGIS.ocx is a FREE and OPEN SOURCE C++ based geographic information system programming ActiveX Control and application programmer interface (API) that can be added to a Windows Form in Visual Basic, C#, Delphi, or other languages that support ActiveX, providing your app with a map. Go to our forum for questions and help:
How to obtain the elevation data value according to the row and column number,After obtaining the IDISPATCH type?
I don’t know why the elevation value I get is always wrong
How to obtain the elevation data value according to the row and column number,After obtaining the IDISPATCH type? I don’t know why the elevation value I get is always wrong
LPDISPATCH lpDispatch = m_map.get_GetObject(layerHandle); //hr = lpDispatch->QueryInterface(IID_IDispatch, (void **)&typeinfo); UINT count; lpDispatch->GetTypeInfoCount(&count); DISPID dispid; DISPID PropertyID[5] = { 0 }; BSTR PropName[5]; PropName[0] = SysAllocString(L"Value"); PropName[1] = SysAllocString(L"row"); PropName[2] = SysAllocString(L"col");
lpDispatch->GetIDsOfNames(IID_NULL, PropName, 3, LOCALE_SYSTEM_DEFAULT, PropertyID);
VARIANTARG v[3];
v[0].lVal = 1000;
v[1].lVal = 710; v[2].pintVal= &h ; DISPPARAMS params = {v,NULL,2,0};
VARIANT vResult;
HRESULT ok = lpDispatch->Invoke(PropertyID[0], IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, ¶ms, &vResult, NULL, NULL); if (SUCCEEDED(ok)) { TRACE("%d",vResult.iVal); }