public static IntPtr WTS_CURRENT_SERVER_HANDLE = IntPtr.Zero; public static int WTS_CURRENT_SESSION = 1; [DllImport("wtsapi32.dll", SetLastError = true)] 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); bool result = false; String title = "Alert"; int tlen = title.Length; String msg = sb.ToString(); int mlen = msg.Length; int resp = 4; result = WTSSendMessage(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, title, tlen, msg, mlen, 0, 3, out resp, true); int err = Marshal.GetLastWin32Error();
WTSSendMessage
Allow service to interact with desktop
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)