#region Windows Api 定义
[DllImport("user32.dll")]
public static extern void mouse_event(MouseEvents dwFlags, long dx, long dy, long cButtons, long dwExtraInfo);
public enum MouseEvents : uint
{
MOUSEEVENTF_LEFTDOWN = 0x2,
MOUSEEVENTF_LEFTUP = 0x4,
MOUSEEVENTF_MIDDLEDOWN = 0x20,
MOUSEEVENTF_MIDDLEUP = 0x40,
MOUSEEVENTF_MOVE = 0x1,
MOUSEEVENTF_ABSOLUTE = 0x8000,
MOUSEEVENTF_RIGHTDOWN = 0x8,
MOUSEEVENTF_RIGHTUP = 0x10,
}
[DllImport("user32.dll")]
public static extern int FindWindow(String lpClassName, String lpWindowName);
[DllImport("user32.dll")]
public static extern int GetClassName(int hwnd, System.Text.StringBuilder buf, int nMaxCount);
[DllImport("user32.dll")]
public static extern int GetWindowText(int hwnd, System.Text.StringBuilder buf, int nMaxCount);
[DllImport("user32.dll")]
public static extern void SetForegroundWindow(int hwnd);
[DllImport("user32.dll")]
public static extern bool ShowWindow(int hWnd, nCmdShow nCmdShow);
public enum nCmdShow : uint
{
SW_FORCEMINIMIZE = 0x0,
SW_HIDE = 0x1,
SW_MAXIMIZE = 0x2,
SW_MINIMIZE = 0x3,
SW_RESTORE = 0x4,
SW_SHOW = 0x5,
SW_SHOWDEFAULT = 0x6,
SW_SHOWMAXIMIZED = 0x7,
SW_SHOWMINIMIZED = 0x8,
SW_SHOWMINNOACTIVE = 0x9,
SW_SHOWNA = 0xA,
SW_SHOWNOACTIVATE = 0xB,
SW_SHOWNORMAL = 0xC,
}
[DllImport("user32.dll")]
public static extern long GetCursorPos(ref System.Drawing.Point lpPoint);
#endregion