[DllImport("user32.dll")]
private static extern int CloseWindow (int hwnd);
or:
[DllImport("user32.dll", EntryPoint="SendMessageA")]
private static extern int SendMessage (int hwnd, int wMsg, int wParam, int lParam);
private const int WM_CLOSE = 0x10;