InetSendGetMagGlassDataRsp Example for C++ 5.0 and later

Note:

This is not a complete example for handling events, some steps have been omitted. For a complete example of how to handle events, refer to the example Initializing a Computer as a Server and Accepting Connections.

void CRasterInetSink::OnInetReceiveCmd(short iComputer, short InetCommand, long nCommandID, short nError, struct ILEADRasterInetPacket * Params, long nExtraDataSize, ILEADRasterVariant * ExtraData)
{
   short nStatus;
   CString szOut;
   CString szTmp;
   ILEADRasterInetPacket *Packet = Params;
   CLEADRasterView *pLead=NULL;
   VARIANT vColorBuffer;

   nStatus = ERROR_FEATURE_NOT_SUPPORTED;

   szOut.Format(TEXT("Command %d id=%d, nError=%d nParams=%d received."), InetCommand, nCommandID, nError, Packet->GetParamCount());

   if(nExtraDataSize > 0)
   {
      szTmp.Format(TEXT(", nExtraDataSize=%d"), nExtraDataSize);
      szOut = szOut + szTmp;
   }
   OutputDebugString(szOut);
   OutputDebugString(TEXT("\n"));

   if(nError != 0)
      nStatus = ERROR_TRANSFER_ABORTED;
   else
   {
      switch(InetCommand)
      {
         case INETCMD_GET_MAGGLASS_DATA:
            // check the validity of the parameters
            if((Packet->GetParamCount() == 5) && (Packet->GetParamType(0) == PARAM_TYPE_UINT32) &&
(Packet->GetParamType(1) == PARAM_TYPE_UINT32) && (Packet->GetParamType(2) == PARAM_TYPE_USTRING) &&
(Packet->GetParamType(3) == PARAM_TYPE_INT16) && (Packet->GetParamType(4) == PARAM_TYPE_INT16))
            {
               // Note: This is a function you must create to get a pointer to the
               // control that has the bitmap.
               pLead = FindLBitmap(Packet->GetParamValue(0)->DoubleValue );

               if(pLead)
               {
                  nStatus = m_pDlg->m_pRasterInet->InetGetMagGlassData(pLead->GetRaster().m_lpDispatch, &vColorBuffer,
Packet->GetParamValue(2), Packet->GetParamValue(3)->LongValue, Packet->GetParamValue(4)->LongValue);
               }
               else
                  nStatus = ERROR_INV_PARAMETER; // invalid parameter

               m_pDlg->m_pRasterInet->InetSendGetMagGlassDataRsp(nCommandID, vColorBuffer, Packet->GetParamValue(2), Packet->GetParamValue(3)->LongValue, Packet->GetParamValue(4)->LongValue , 0, NULL, nStatus);
               return;
            }
         break;
      }
   }
   //return an error response
   m_pDlg->m_pRasterInet->InetSendRsp((InetCmdType)InetCommand, nCommandID, NULL, 0, NULL, nStatus);
}