The 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 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.
| Value | Meaning |
- IDABORT
- 3
| Abort
|
- IDCANCEL
- 2
| Cancel
|
- IDIGNORE
- 5
| Ignore
|
- IDNO
- 7
| No
|
- IDOK
- 1
| OK
|
- IDRETRY
- 4
| Retry
|
- IDYES
- 6
| Yes
|
- IDASYNC
- 32001 (0x7D01)
| The bWait parameter was FALSE, so the function
returned without waiting for a response.
|
- IDTIMEOUT
- 32000 (0x7D00)
| The bWait parameter was TRUE and the time-out
interval elapsed.
|
- 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 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| Header | Wtsapi32.h |
| Library | Wtsapi32.lib |
| DLL | Wtsapi32.dll |
| Unicode and ANSI names | WTSSendMessageW (Unicode) and WTSSendMessageA (ANSI) |
See Also
- MessageBox
Send comments about this topic to Microsoft
Build date: 10/19/2009