-----------------------------------------
private const UInt32 MOUSEEVENTF_LEFTDOWN = 0x0002;
private const UInt32 MOUSEEVENTF_LEFTUP = 0x0004;
private const UInt32 MOUSEEVENTF_MIDDLEDOWN = 0x00000020;
private const UInt32 MOUSEEVENTF_MIDDLEUP = 0x00000040;
private const UInt32 MOUSEEVENTF_MOVE = 0x00000001;
private const UInt32 MOUSEEVENTF_WHEEL = 0x00000800;
private const UInt32 MOUSEEVENTF_ABSOLUTE = 0x00008000;
private const UInt32 MOUSEEVENTF_RIGHTDOWN = 0x00000008;
private const UInt32 MOUSEEVENTF_RIGHTUP = 0x00000010;
[DllImport("user32.dll")]
private static extern void mouse_event(
UInt32 dwFlags, // motion and click options
UInt32 dx, // horizontal position or change
UInt32 dy, // vertical position or change
int dwData, // wheel movement
IntPtr dwExtraInfo // application-defined information
);
--------------------------------------------
private const int KEYEVENTF_KEYUP = 0x2;
private const int KEYEVENTF_EXTENDEDKEY = 0x1;
private const int KEYEVENTF_KEYDOWN = 0x0;
[DllImport("user32.dll")]
private static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
VOID keybd_event(
BYTE bVk, // virtual-key code
BYTE bScan, // hardware scan code
DWORD dwFlags, // flags specifying various function options
DWORD dwExtraInfo // additional data associated with keystroke
);
---------------------------------------------
留言列表