LInet::SendAttachBitmapCmd

#include " ltwrappr.h "

L_INT LInet::SendAttachBitmapCmd (plRemoteComp, uCommandID, uBitmapID, uWindowID)

LInet * plRemoteComp;

/* instance of a remote computer */

L_UINT uCommandID;

/* command id */

L_UINT uBitmapID;

/* bitmap id */

LONG_PTR uWindowID;

/* window id */

Sends an attach bitmap command to a remote computer.

Parameter

Description

plRemoteComp

Instance of the remote computer to which the command will be sent.

uCommandID

Command ID. Each command sent by a member of a connection should have a unique ID. Since a member of a connection may send several commands, this ID allows that member to identify when a specific command request has been completed.

uBitmapID

The ID of the bitmap being attached. If the bitmap is successfully attached, then this bitmap will be painted whenever the window paints itself.

uWindowID

The id of the window that was just created.

Returns

SUCCESS

This function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The remote computer should respond by calling LInet::SendAttachBitmapRsp in its LInet::CommandCallBack function.

Once the remote computer receives this command it should always paint the specified bitmap inside the specified window. Both the bitmap and the window should exist on the remote computer. The remote computer will most likely paint the window at 1:1 ratio, adding scrollbars if possible. To change the way the bitmap is painted, call LInet::SendSetRectCmd.

The LInet::CommandCallBackfunction will receive the uBitmapID and uWindowID information in the pParams parameter. The uBitmapID information will be in pParams[0] and the uWindowID information will be in pParams[1].

To process responses to commands, a class must be derived from LInet and the LInet::ResponseCallBackmember function must be overridden.

Required DLLs and Libraries

LTNET

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LInet::SendAttachBitmapRsp, LInet::ResponseCallBack, LInet::CommandCallBack, Class Members

Topics:

Sending Commands and Responses

 

A Client Server Diagram: Sending Commands and Responses

Example

This example sends a message to a remote connection to attach a loaded bitmap to a created window.

class CUserNet : public LInet
{
   L_UINT m_uBitmapID;
   L_UINT m_uWindowID;
public:
   //LInet *m_plConnection;
   L_INT  OnConnect(LInet *plConnection, L_INT nError)
   {
      L_INT   nRet = SUCCESS;
      L_CHAR  *pszHostName;
      L_TCHAR strMsg[L_MAXPATH];
      
      if(nError != SUCCESS)
      {
         wsprintf(strMsg, _T("Error[%d]: OnConnect"), nRet);
         MessageBox(NULL, strMsg, 0 , 0);
         return nError;
      }
      
      // Get the remote computer name   
      if ((pszHostName = plConnection->GetHostName(HOST_NAME_IP)) == NULL)      
         return FAILURE;   
      wsprintf(strMsg, _T("OnConnect: Connected to %hs"), (LPTSTR)pszHostName);
      MessageBox(0, strMsg, 0, 0);
      this->SendLoadCmd(plConnection, CMD_LOAD, TEXT("E:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\IMAGE1.CMP"));
      return nRet;
   }
};
L_INT LInet__SendAttachBitmapCmdExample()
{
   static CUserNet  Client;
   Client.StartUp();
   Client.Connect("127.0.0.1", 1000);
   return SUCCESS;
}