LInetPacket::SetFormats
#include "ltwrappr.h"
L_INT LInetPacket::SetFormats(pszFormat)
L_CHAR * pszFormat; |
/* format describing the parameters */ |
Sets or changes the parameter data associated with the LlnetPacket object.
Parameter |
Description | |
pszFormat |
Format of the command parameters. Possible values are: | |
|
Value |
Meaning |
|
%d |
decimal integer |
|
%l |
long signed integer |
|
%c |
character |
|
%s |
string |
|
%ud |
unsigned long integer |
|
%us |
unsigned short integer |
|
%ss |
signed short integer Variable list of parameters for this command. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An occurred. Refer to Return Codes. |
Comments
This function allows the user to set or change the parameter data associated with the LlnetPacket object. Note that this packet can be used to send both commands and responses. A packet can contain a binary chunk and a variable number of arguments.
To set or change the extra data, call LInetPacket::SetExtraData.
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: |
|
Topics: |
Example
//This example sends a message to a remote connection to get a bitmap and send to the client //This example also sets extra data to a sample string //It is assumed that: //1. m_Inet is 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 //6. m_uWindowID is a window id that is received in the LInet::ResponseCallBack() as a result // of a call to m_Inet.SendCreateWinCmd() //7. m_uBitmapID is a bitmap id that is received in the LInet::ResponseCallBack() as a result // of a call to m_Inet.SendLoadCmd() void OnRemoteGetbitmap(LInet Inet, LInet * m_pInetRemoteServer) { CMDTYPE cmd = (CMDTYPE)(CMD_USER_CUSTOM + 1); L_INT nBitmapID = -1; L_INT nRet; LInetPacket InetPacket; InetPacket.SetFormats("%ud", nBitmapID); L_CHAR *pszExtraData = "*** Sample Extra Data ***\n"; InetPacket.SetExtraData ((L_UINT)strlen(pszExtraData) + 1, pszExtraData ); nRet = Inet.SendCmd(m_pInetRemoteServer, cmd, 0, &InetPacket); if(nRet != SUCCESS && nRet != ERROR_DATA_QUEUED) { L_TCHAR * szBuffer[100]; memset(szBuffer, 0, 100); wsprintf((LPWSTR)szBuffer, TEXT("Error[%d]: OnRemoteGetbitmap"), nRet); MessageBox(NULL, (LPWSTR)szBuffer, TEXT("Error!"), MB_OK); } //LInetPacket destructor called here ... }