鼠標移動(移動量dx,dy)
mouse_event(MOUSEEVENTF_MOVE,dx,dy,0, 0 );
鼠標在(x,y)處按下或釋放
setcursorpos(x,y);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 );
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0 );
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 );
mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0 );
鼠標雙擊由兩次按下與釋放來模擬
鍵盤模擬
一般虛擬鍵值(VK_)由KeyDown或keyup事件得到
特殊鍵值
Tab--9
Shift--16
Ctrl--17
Alt--18
CapsLock--20
Esc--27
Win--91,92
NUMLock--144
ScrollLock--145
按下鍵
keybd_event(key, MapVirtualKey(key, 0 ), KEYEVENTF_KEYUP , 0 );
釋放鍵
keybd_event(key, MapVirtualKey(key, 0 ), 0 , 0 );
以上做法對大多數鍵有效,少數鍵要用到不同的值