CHttpServer::GetCommandName Method  
 
INT GetCommandName
  UINT nClientId,  
  LPTSTR lpszCommand,  
  INT nMaxLength  
);
INT GetCommandName
  UINT nClientId,  
  CString& strCommand  
);

Return the name of the last command issued by the client.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session.
lpszCommand
A pointer to a string buffer that will contain the command name. The string buffer will be null terminated and must be large enough to store the complete parameter value. If this parameter is NULL, the method will only return the length of the current command in characters, not including the terminating null character. An alternate version of this method accepts a CString object if it is available.
nMaxLength
An integer value that specifies the maximum number of characters that can be copied into the string buffer, including the terminating null character. If the maximum length specified is smaller than the actual length of the parameter, this method will fail. If the lpszCommand parameter is NULL, this value should be zero.

Return Value

An integer value which specifies the number of characters copied into the buffer, not including the terminating null character. If the method fails, the return value will be zero and the GetLastError method can be used to retrieve the last error code. If the last error code is returned as a value of zero, this means that no command has been issued by the client.

Remarks

The GetCommandName method is used to obtain the name of the last command that was issued by the client. The command name returned by this method will always be capitalized, regardless of how it was sent by the client. This method is typically used inside the OnCommand and OnResult event handlers to pre-process and post-process client commands, respectively. It should not be called inside a OnConnect event handler because the server has not processed the client request at that point.

The GetCommandUrl function can be used to return the resource that was requested by the client.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: cshtsv11.lib
Unicode: Implemented as Unicode and ANSI versions

See Also

GetCommandFile, GetCommandUrl, OnCommand, OnResult