InetSendCmd Example for C++ 5.0 and later

// my user defined commands
#define INETCMD_FLIP INETCMD_USER_CUSTOM

short nRet;
CString csOut;
ILEADRasterInetPacket *pPacket=NULL;
TCHAR szText[]=TEXT("This is Flip");
HRESULT hr;
ILEADRasterVariant * pltRasVar1 = NULL;
ILEADRasterVariant * pltRasVar2 = NULL;

CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)&pltRasVar1);

CoCreateInstance(CLSID_LEADRasterVariant, NULL, CLSCTX_ALL,
IID_ILEADRasterVariant, (void **)&pltRasVar2);

hr = CoCreateInstance(CLSID_LEADRasterInetPacket, NULL, CLSCTX_ALL, IID_ILEADRasterInetPacket, (void**)&pPacket);

pPacket->put_ParamCount(1);
pltRasVar1->Type = VALUE_ULONG;
pltRasVar1->DoubleValue = 999

pPacket->put_ParamValue(0, pltRasVar1);
pPacket->put_ParamType(0, PARAM_TYPE_UINT32);

pltRasVar2->Type = VALUE_STRING;


lstrcpy(pltRasVar2->ShortValue, szText);

nRet = m_pRasterInet->InetSendCmd(INETCMD_FLIP, 999, pPacket, lstrlen(szText) + 1, pltRasVar2);

if((nRet != 0) && (nRet != ERROR_DATA_QUEUED))
{
   csOut.Format(TEXT("ERROR %d calling InetSendCmd.\n"), nRet);
   OutputDebugString(csOut);
}
else
   OutputDebugString(TEXT("InetSendCmd Executed.\n"));

pPacket->Release();
pltRasVar1->Release();
pltRasVar2->Release();