Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Runtime.InteropServices;
- class Test
- {
- public const int WM_CLOSE = 0x10;
- [DllImport("user32.dll", SetLastError = true)]
- static extern IntPtr FindWindow(string className, string windowName);
- [DllImport("user32.dll", CharSet = CharSet.Auto)]
- static extern IntPtr SendMessage(IntPtr hwnd, int msg, int wParam, int lParam);
- public static void Main(string[] args)
- {
- IntPtr hwnd = FindWindow("progman", null);
- SendMessage(hwnd, WM_CLOSE, 0, 0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement