mouse_event,keybd_event

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;
代码
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);
}
keybd_event

代码
//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);

 

posted @ 2010-12-28 10:12  Jekhn  阅读(444)  评论(0编辑  收藏  举报