mouse_event
代码
procedure MyMouseClick();
begin
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
end;
procedure MyMouseDBClick()
begin
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
end;
代码
keybd_event
void MyMouseClick()
{
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
void MyMouseDBClick()
{
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
代码
//a
keybd_event(Ord('A'), KEYEVENTF_EXTENDEDKEY or 0, 0);
keybd_event(Ord('A'), 0, KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP, 0);
//A
keybd_event(VK_SHIFT, 0, KEYEVENTF_EXTENDEDKEY or 0, 0);
keybd_event(Ord('A'), KEYEVENTF_EXTENDEDKEY or 0, 0);
keybd_event(Ord('A'), 0, KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP, 0);
keybd_event(VK_SHIFT, 0, KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP, 0);
//Ctrl + A
keybd_event(VK_CONTROL, 0, KEYEVENTF_EXTENDEDKEY or 0, 0);
keybd_event(65, 0, KEYEVENTF_EXTENDEDKEY or 0, 0);
keybd_event(65, 0, KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP, 0);
keybd_event(VK_CONTROL, 0, KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP, 0);