WTSSendMessage function
Displays a message box on the client desktop of a specified Remote Desktop Services session.
Syntax
BOOL WTSSendMessage( _In_ HANDLE hServer, _In_ DWORD SessionId, _In_ LPTSTR pTitle, _In_ DWORD TitleLength, _In_ LPTSTR pMessage, _In_ DWORD MessageLength, _In_ DWORD Style, _In_ DWORD Timeout, _Out_ DWORD *pResponse, _In_ BOOL bWait );
Parameters
- hServer [in]
-
A handle to an RD Session Host server. Specify a handle opened by the WTSOpenServer function, or specify WTS_CURRENT_SERVER_HANDLE to indicate the RD Session Host server on which your application is running.
- SessionId [in]
-
A Remote Desktop Services session identifier. To indicate the current session, specify WTS_CURRENT_SESSION. You can use the WTSEnumerateSessions function to retrieve the identifiers of all sessions on a specified RD Session Host server.
To send a message to another user's session, you need to have the Message permission. For more information, see Remote Desktop Services Permissions. To modify permissions on a session, use the Remote Desktop Services Configuration administrative tool.
- pTitle [in]
-
A pointer to a null-terminated string for the title bar of the message box.
- TitleLength [in]
-
The length, in bytes, of the title bar string.
- pMessage [in]
-
A pointer to a null-terminated string that contains the message to display.
- MessageLength [in]
-
The length, in bytes, of the message string.
- Style [in]
-
The contents and behavior of the message box. This value is typically MB_OK. For a complete list of values, see the uType parameter of the MessageBox function.
- Timeout [in]
-
The time, in seconds, that the WTSSendMessage function waits for the user's response. If the user does not respond within the time-out interval, the pResponse parameter returns IDTIMEOUT. If the Timeout parameter is zero, WTSSendMessage waits indefinitely for the user to respond.
- pResponse [out]
-
A pointer to a variable that receives the user's response, which can be one of the following values.
- bWait [in]
-
If TRUE, WTSSendMessage does not return until the user responds or the time-out interval elapses. If the Timeout parameter is zero, the function does not return until the user responds.
If FALSE, the function returns immediately and the pResponse parameter returns IDASYNC. Use this method for simple information messages (such as print job–notification messages) that do not need to return the user's response to the calling program.
Return value
If the function succeeds, the return value is a nonzero value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Requirements
|
Minimum supported client |
Windows Vista |
|---|---|
|
Minimum supported server |
Windows Server 2008 |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
WTSSendMessageW (Unicode) and WTSSendMessageA (ANSI) |
See also