Difference between revisions of "Stop managed code for debug"
(Created page with "<code><pre> public static IntPtr WTS_CURRENT_SERVER_HANDLE = IntPtr.Zero; public static int WTS_CURRENT_SESSION = -1; [DllImport("wtsapi32.dll", SetLastError = true)]...") |
|||
Line 1: | Line 1: | ||
<code><pre> | <code><pre> | ||
public static IntPtr WTS_CURRENT_SERVER_HANDLE = IntPtr.Zero; | public static IntPtr WTS_CURRENT_SERVER_HANDLE = IntPtr.Zero; | ||
− | + | public static int WTS_CURRENT_SESSION = -1; | |
[DllImport("wtsapi32.dll", SetLastError = true)] | [DllImport("wtsapi32.dll", SetLastError = true)] | ||
Line 22: | Line 22: | ||
</pre></code> | </pre></code> | ||
+ | |||
+ | Tags: stop, service, debug, managed, c#, program, pause |
Latest revision as of 12:53, 1 November 2019
public static IntPtr WTS_CURRENT_SERVER_HANDLE = IntPtr.Zero;
public static int WTS_CURRENT_SESSION = -1;
[DllImport("wtsapi32.dll", SetLastError = true)]
public static extern bool WTSSendMessage(
IntPtr hServer,
[MarshalAs(UnmanagedType.I4)] int SessionId,
String pTitle,
[MarshalAs(UnmanagedType.U4)] int TitleLength,
String pMessage,
[MarshalAs(UnmanagedType.U4)] int MessageLength,
[MarshalAs(UnmanagedType.U4)] int Style,
[MarshalAs(UnmanagedType.U4)] int Timeout,
[MarshalAs(UnmanagedType.U4)] out int pResponse,
bool bWait);
string Title = "Hello";
string msg = "Message from service";
int resp = 0;
WTSSendMessage(WTS_CURRENT_SERVER_HANDLE, 1, Title, Title.Length, msg, msg.Length, 0, 0, out resp, true);
Tags: stop, service, debug, managed, c#, program, pause