Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
L_InetSendCreateWinCmd
#include "l_bitmap.h"
#include "ltnet.h"
L_LTNET_API L_INT L_InetSendCreateWinCmd(hComputer, uCommandID, pszClassName, pszWindowName, ulFlags, nLeft, nTop, nWidth, nHeight, uParentID)
L_COMP hComputer; |
/* handle to a remote computer */ |
L_UINT uCommandID; |
/* command id */ |
L_TCHAR * pszClassName; |
/* window class name */ |
L_TCHAR * pszWindowName; |
/* name of window */ |
L_UINT ulFlags; |
/* window creation flags */ |
L_INT nLeft; |
/* x coordinate */ |
L_INT nTop; |
/* y coordinate */ |
L_INT nWidth; |
/* width */ |
L_INT nHeight; |
/* height */ |
L_UINT uParentID; |
/* parent id */ |
Sends a create win command to a remote computer.
Parameter |
Description |
hComputer |
Handle 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. |
pszClassName |
Character string containing the class name for which to register the window. This must be a valid string, and should be related to your application, to avoid conflicting with an existing registered window class name. |
pszWindowName |
Character string containing the name of the window. This parameter can be an empty string (""). |
ulFlags |
Flags that indicate how to create the window. It is recommended to use the same flags shown in CreateWindow in the Microsoft SDK. However, you can pass 0 if you do not wish to use ulFlags, or you can define your own flags |
nLeft |
X coordinate for the origin of the window to create. |
nTop |
Y coordinate for the origin of the window to create. |
nWidth |
Requested width of the window's client area. |
nHeight |
Requested height of the window's client area. |
uParentID |
Id of the parent or owner window of the window being created. |
Returns
SUCCESS |
This function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
The remote computer should respond by calling L_InetSendCreateWinRsp in its INETCOMMANDCALLBACK function. This callback function must be set using L_InetSetCommandCallback.
With this command, the local computer will signal the remote computer to create a window using the specified parameters. The window identifier will be sent in the response to this command.
To receive responses to commands, provide an INETRESPONSECALLBACK function. This function must be set using L_InetSetResponseCallback.
The INETCOMMANDCALLBACK function will receive the pszClassName, pszWindowName, ulFlags, nLeft, nTop, nWidth, nHeight and uParentID information in the pParams parameter. The pszClassName information will be in pParams[0]. The pszWindowName information will be in pParams[1], the ulFlags information will be in pParams[2], 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: |
L_InetSendCreateWinRsp, INETRESPONSECALLBACK, INETCOMMANDCALLBACK |
Topics: |
|
|
Example
L_UINT guCommandID; //********** Code on the local computer ****************/ // Note that pszRemoteFilename is a file name on the remote computer! L_INT CreateRemoteWindow(L_COMP hComputer) { return L_InetSendCreateWinCmd(hComputer, guCommandID++, TEXT(""), // class TEXT("Window created by remote computer"), // title 0, // flags 100, 50, 300, 150, // position and size 0); // parent } //********** Code on the remote computer ****************/ HWND CreateChildWindow(L_TCHAR *pszClassName, L_TCHAR *pszWindowName, UINT32 ulFlags, L_INT nLeft, L_INT nTop, L_INT nWidth, L_INT nHeight, L_UINT hwndParent) { UNREFERENCED_PARAMETER(hwndParent); UNREFERENCED_PARAMETER(pszClassName); UNREFERENCED_PARAMETER(pszWindowName); UNREFERENCED_PARAMETER(nLeft); UNREFERENCED_PARAMETER(ulFlags); UNREFERENCED_PARAMETER(nTop); UNREFERENCED_PARAMETER(nHeight); UNREFERENCED_PARAMETER(nWidth); // create the window here� return 0; } L_INT AttachBitmap(L_UINT uBitmapID, L_UINT uWindowID) { // Attach the local bitmap uBitmapID to the local window uWindowID // To put it another way, "Make the bitmap with ID bitmap ID paint in the window uWindowID" // Usually, the window ID is the window handle. // For a complete example, see the NETCMD sample application. UNREFERENCED_PARAMETER(uBitmapID); UNREFERENCED_PARAMETER(uWindowID); return 0; } L_INT EXT_CALLBACK InetCommandCallback(L_COMP hComputer, CMDTYPE uCommand, L_UINT uCommandID, L_INT nError, L_UINT uParams, pPARAMETER pParams, L_UINT uExtra, L_CHAR *pExtra, L_VOID *pUserData) { UNREFERENCED_PARAMETER(uExtra); UNREFERENCED_PARAMETER(pExtra); UNREFERENCED_PARAMETER(pUserData); L_INT nStatus = ERROR_INV_PARAMETER; L_UINT uBitmapID = (L_UINT)-1; UNREFERENCED_PARAMETER(uBitmapID); if(nError != SUCCESS) nStatus = ERROR_TRANSFER_ABORTED; else switch(uCommand) { case CMD_CREATE_WIN: // check the validity of the parameters if(uParams == 8 && pParams[0].uType == PARAM_STRING && pParams[1].uType == PARAM_STRING && pParams[2].uType == PARAM_UINT32 && pParams[3].uType == PARAM_INT32 && pParams[4].uType == PARAM_INT32 && pParams[5].uType == PARAM_INT32 && pParams[6].uType == PARAM_INT32 && pParams[7].uType == PARAM_UINT32) { HWND hwnd = CreateChildWindow((L_TCHAR*)pParams[0].pValue, (L_TCHAR*)pParams[1].pValue, pParams[2].uiValue, pParams[3].iValue, pParams[4].iValue, pParams[5].iValue, pParams[6].iValue, pParams[7].uiValue); // If CreateChildWindow failed, one of the parameters must be invalid nStatus = hwnd ? SUCCESS : ERROR_INV_PARAMETER; return L_InetSendCreateWinRsp(hComputer, uCommandID, (LONG_PTR)hwnd, 0, NULL, nStatus); } break; case CMD_ATTACH_BITMAP: if(uParams == 2 && pParams[0].uType == PARAM_UINT32 && pParams[1].uType == PARAM_UINT32) nStatus = AttachBitmap(pParams[0].uiValue, pParams[1].uiValue); return L_InetSendAttachBitmapRsp(hComputer, uCommandID, 0, NULL, nStatus); case CMD_SIZE_WIN: if(uParams == 5 && pParams[0].uType == PARAM_UINT32 && pParams[1].uType == PARAM_INT32 && pParams[2].uType == PARAM_INT32 && pParams[3].uType == PARAM_INT32 && pParams[4].uType == PARAM_INT32) { // move and repaint the window //L_VOID *Temp = (L_VOID *)(pParams[0].uiValue); SIZE_T Temp =(pParams[0].uiValue); //L_INT * Temp1 = (L_INT *)Temp; if(MoveWindow((HWND)Temp, pParams[1].iValue, pParams[2].iValue, pParams[3].iValue, pParams[4].iValue, TRUE)) nStatus = SUCCESS; } return L_InetSendSizeWinRsp(hComputer, uCommandID, 0, NULL, nStatus); case CMD_SHOW_WIN: if(uParams == 2 && pParams[0].uType == PARAM_UINT32 && pParams[1].uType == PARAM_INT32) { SIZE_T Temp =(pParams[0].uiValue); if(IsWindow((HWND)Temp)) { ShowWindow((HWND)Temp, pParams[1].iValue); nStatus = SUCCESS; } } return L_InetSendShowWinRsp(hComputer, uCommandID, 0, NULL, nStatus); case CMD_CLOSE_WIN: if(uParams == 1 && pParams[0].uType == PARAM_UINT32) { L_SIZE_T Temp =(pParams[0].uiValue); if(DestroyWindow((HWND)Temp)) nStatus = SUCCESS; } return L_InetSendCloseWinRsp(hComputer, uCommandID, 0, NULL, nStatus); default: // this command is not supported nStatus = ERROR_FEATURE_NOT_SUPPORTED; break; } return L_InetSendRsp(hComputer, uCommand, uCommandID, NULL, nStatus); }