C# codeusing System.Runtime.InteropServices;
public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll")]
public static extern IntPtr SetWindowsHookEx(int hookid,
HookProc pfnhook, IntPtr hinst, int threadid);
[DllImport("user32.dll")]
public static extern IntPtr CallNextHookEx(IntPtr hhook,
int code, IntPtr wparam, IntPtr lparam);
[DllImport("kernel32.dll")]
public static extern IntPtr GetModuleHandle(string modName);
[DllImport("user32.dll")]
public static extern bool UnhookWindowsHookEx(IntPtr hhook);
[DllImport("user32.dll")]
public static extern bool GetWindowRect(IntPtr hWnd, ref Rectangle rect);
[DllImport("user32.dll")]
public static extern bool MoveWindow(
IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRe