LInet::SendLoadCmd

#include " ltwrappr.h "

L_INT LInet::SendLoadCmd (plRemoteComp, uCommandID, pszFile, nBitsPerPixel=0, nOrder=ORDER_BGR, uFlags=LOADFILE_ALLOCATE|LOADFILE_STORE)

LInet L_FAR * plRemoteComp;

/* instance of a remote computer */

L_UINT uCommandID;

/* command id */

L_TCHAR L_FAR * pszFile;

/* filename */

L_INT nBitsPerPixel;

/* resulting bitmap pixel depth */

L_INT nOrder;

/* desired color order */

L_UINT uFlags;

/* flags that determine function behavior */

Sends a load command to a remote computer. This function is only available in the Internet toolkit.

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 .

pszFile

Character string containing the name of the image file to load. This should be the name of a file on the computer receiving the command.

nBitsPerPixel

Resulting bitmap pixel depth. The following are valid values:

 

Value

Meaning

 

0

Keep the original file's pixel depth (Do not convert).

 

1 to 8

The specified bits per pixel in the resultant bitmap

 

12

12 bits per pixel in the resultant bitmap.

 

16

16 bits per pixel in the resultant bitmap

 

24

24 bits per pixel in the resultant bitmap

 

32

32 bits per pixel in the resultant bitmap

 

48

48 bits per pixel in the resultant bitmap

 

64

64 bits per pixel in the resultant bitmap

nOrder

Color order for 16-, 24-, 32-, 48-, and 64-bit bitmaps. If the resultant bitmap is less than 16 bits per pixel, this will have no effect since palettized images have no order. The following are valid values:

 

Value

Meaning

 

ORDER_RGB

[0] Red, green, and blue color order in memory

 

ORDER_BGR

[1] Blue, green, and red color order in memory

 

ORDER_GRAY

[2] 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are only supported in the Document/Medical Imaging editions .

 

ORDER_RGBORGRAY

[3] Load the image as red, green, blue OR as a 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are supported in the Document/Medical Imaging editions only.

 

ORDER_BGRORGRAY

[4] Load the image as blue, green, red OR as a 12 or 16-bit grayscale image. 12 and 16-bit grayscale images are supported in the Document/Medical Imaging editions only.

uFlags

Binary flags that determine the behavior of the loading process. You can pass some user-defined flag values, or specify one or more of the following values:

 

Value

Meaning

 

LOADFILE_ALLOCATE

[0x0001] The function allocates memory for the specified bitmap. (This takes place in addition to the actions of your callback function.)

 

LOADFILE_STORE

[0x0002] The function loads data into the specified bitmap. (This takes place in addition to the actions of your callback function.)

Returns

SUCCESS

This function was successful.

< 1

An occurred. Refer to Return Codes.

Comments

The remote computer should respond by calling LInet::SendLoadRspin its LInet::CommandCallBackfunction.

With this command, the local computer will signal the remote computer to load a bitmap and send across the bitmap identifier (not the bitmap data!). The local computer can then use the bitmap identifier in other commands (like LInet::SendAttachBitmapCmd). The bitmap identifier will be sent in the response to this command.

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

The LInet::CommandCallBack function will receive the pszFile, nBitsPerPixel, nOrder and uFlags information in the pParams parameter. The pszFile information will be in pParams[0]. The nBitsPerPixel information will be in pParams[1], and so forth.

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::SendLoadRsp, LInet::CommandCallBack, LInet::ResponseCallBack, 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 load a bitmap
//It assumed that:
//1.  m_Inet and m_pInetRemoteServer are an object of the class Linet.
//2.  the network as been started (LInet::StartUp()) 
//3.  a connection has been established with a remote server (LInet::m_Inet.Connect())
//4.  GetNextCommandID() is a function that returns a unique command identifier
//5.  UpdateStatusbar() is a function that displays a message in the status bar
void CMainFrame::OnRemoteLoadbitmap () 
{
   L_INT nRet = SUCCESS;
   
   nRet = m_Inet.SendLoadCmd(m_pInetRemoteServer, GetNextCommandID(), TEXT("..\\images\\image2.cmp"));
   if(nRet != SUCCESS && nRet != ERROR_DATA_QUEUED)
   {
      UpdateStatusbar(TEXT("Error[%d]: OnRemoteLoadbitmap"), nRet);
   }
   else
   {
      UpdateStatusbar(TEXT("Success: OnRemoteLoadbitmap"), nRet);
   }
}

//The CommandCallBack() is processed on the server
//To process the commands sent to the computer, you must:
//1. Derive a class from LInet
//2. Override the CommandCallBack member function
//
//Assume that 
//1. m_Inet is an object of the class CMyNet (derived from LInet).
//2. the network as been started (LInet::StartUp()) 
//3. a connection has been established with a remote client
//4. UpdateStatusbar() displays a message in the status bar
//5. m_BitmapList maintains a list of LBitmapWindow objects
L_INT CMyNet::CommandCallBack (LInet L_FAR * plConnection,
                              CMDTYPE     uCommand,
                              L_UINT      uCommandID,
                              L_INT       nError,
                              L_UINT      uParams, 
                              pPARAMETER  pParams, 
                              L_UINT      uExtra,
                              L_CHAR L_FAR*pExtra)
{
  CMainFrame *pMain; 
  pMain = GETMAINFRAME; 

   L_INT nStatus = ERROR_FEATURE_NOT_SUPPORTED; 
   L_UINT          uBitmapID = (L_UINT)-1; 
      
   if(nError != SUCCESS) 
      nStatus = ERROR_TRANSFER_ABORTED; 
   else
      switch(uCommand) 
   {
      case CMD_LOAD: 
      {  
            //Here you would add the name bitmap to a list of bitmaps 
            //maintained on the server
            //You must return an ID of the bitmap to the client
            L_INT nIndex=0; 
            
            /* Code example
            nIndex = m_BitmapList.AddBitmap(
               pParams[0].pValue, //file name
               pParams[1].iValue, //nBitsPerPixel
               pParams[2].iValue  //nOrder
               ); 
               */
                        
            return m_Inet.SendLoadRsp(
                                              plConnection, 
                                              uCommandID, 
                                              uBitmapID, 
                                              0, 
                                              NULL, 
                                              nStatus); 
      }
      break;  
      default: 
      {
         return nStatus; 
      }
   }
   return nStatus; 
}