InetSendData2 Example for C++ 5.0 and later

void CNet::Method()
{
   TCHAR szText[]=TEXT("This is a test.");
   VARIANT var;
   SAFEARRAY FAR *psa;
   SAFEARRAYBOUND rgsabound[1];

 

   m_pRasterInet->PutEnableUseLEADRasterVariant(FALSE);

   VariantInit(&var);
   rgsabound[0].lLbound = 0;
   rgsabound[0].cElements = strlen(szText) + 1;

   psa = SafeArrayCreate(VT_UI1, 1, rgsabound);
   if (psa != NULL)
   {
      SafeArrayLock(psa);
      lstrcpy((char far *)psa->pvData, szText);
      SafeArrayUnlock(psa);
      V_VT(&var) = (VT_ARRAY | VT_UI1);
      V_ARRAY(&var) = psa;
      m_pRasterInet->InetSendData2(&var, strlen(szText) + 1, INETDATA_USER2);
      SafeArrayDestroy(psa);
   }
   VariantClear(&var);
}