Click or drag to resize
Xcalibur Systems LLC Logo

TerminalServicesHelperWTSSendMessage Method

Displays a message box on the client desktop of a specified Remote Desktop Services session.

WTSSendMessage function


Namespace: Xcalibur.NativeMethods.V2.TerminalServices
Assembly: Xcalibur.NativeMethods.V2 (in Xcalibur.NativeMethods.V2.dll) Version: 1.0.1.0
Syntax
[DllImportAttribute("wtsapi32.dll", SetLastError = true)]
public static bool WTSSendMessage(
	IntPtr serverHandle,
	int sessionId,
	string title,
	int titleLength,
	string message,
	int messageLength,
	int style,
	int timeout,
	out int response,
	bool wait
)

Parameters

serverHandle  IntPtr
A handle to an RD Session Host server. Specify a handle opened by the function, or specify WTS_CURRENT_SERVER_HANDLE to indicate the RD Session Host server on which your application is running.
sessionId  Int32
A Remote Desktop Services session identifier. To indicate the current session, specify WTS_CURRENT_SESSION. You can use the function to retrieve the identifiers of all sessions on a specified RD Session Host server.
title  String
A pointer to a null-terminated string for the title bar of the message box.
titleLength  Int32
The length, in bytes, of the title bar string.
message  String
A pointer to a null-terminated string that contains the message to display.
messageLength  Int32
The length, in bytes, of the message string.
style  Int32
The contents and behavior of the message box. This value is typically .
timeout  Int32
The time, in seconds, that the function waits for the user's response. If the user does not respond within the time-out interval, the response parameter returns . If the Timeout parameter is zero, waits indefinitely for the user to respond.
response  Int32
A pointer to a variable that receives the user's response of type
wait  Boolean
If TRUE, 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 response parameter returns . 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

Boolean
If the function succeeds, the return value is nonzero. To determine whether the function adjusted all of the specified privileges, call .
See Also

Reference

TerminalServicesHelper Class
Xcalibur.NativeMethods.V2.TerminalServices Namespace
WTSOpenServer(String)
WTSEnumerateSessionsEx(IntPtr, UInt32, UInt32, IntPtr, UInt32)
Okay
WTSSendMessage(IntPtr, Int32, String, Int32, String, Int32, Int32, Int32, Int32, Boolean)
Timeout
WTSSendMessage(IntPtr, Int32, String, Int32, String, Int32, Int32, Int32, Int32, Boolean)
MessageResponseType
WTSSendMessage(IntPtr, Int32, String, Int32, String, Int32, Int32, Int32, Int32, Boolean)
Async
GetLastError