看看msdn帮助吧 The mouse_event function synthesizes mouse motion and button clicks. Windows NT/2000/XP: This function has been superseded. Use SendInput instead.VOID mouse_event( DWORD dwFlags, // motion and click options DWORD dx, // horizontal position or change DWORD dy, // vertical position or change DWORD dwData, // wheel movement ULONG_PTR dwExtraInfo // application-defined information );
看看msdn帮助吧 The mouse_event function synthesizes mouse motion and button clicks. Windows NT/2000/XP: This function has been superseded. Use SendInput instead.VOID mouse_event( DWORD dwFlags, // motion and click options DWORD dx, // horizontal position or change DWORD dy, // vertical position or change DWORD dwData, // wheel movement ULONG_PTR dwExtraInfo // application-defined information );
procedure TForm1.Button1Click(Sender: TObject); var a:tpoint; begin a.X:=self.Left+button2.Left+10; a.Y:=self.Top+ button2.Top+35; setcursorpos(a.x,a.y); mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0); mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0); //mouse_event(MOUSEEVENTF_RIGHTDOWN,0,0,0,0); //mouse_event(MOUSEEVENTF_RIGHTUP,0,0,0,0); end;procedure TForm1.Button2Click(Sender: TObject); begin showmessage('click'); end;
The mouse_event function synthesizes mouse motion and button clicks. Windows NT/2000/XP: This function has been superseded. Use SendInput instead.VOID mouse_event(
DWORD dwFlags, // motion and click options
DWORD dx, // horizontal position or change
DWORD dy, // vertical position or change
DWORD dwData, // wheel movement
ULONG_PTR dwExtraInfo // application-defined information
);
The mouse_event function synthesizes mouse motion and button clicks. Windows NT/2000/XP: This function has been superseded. Use SendInput instead.VOID mouse_event(
DWORD dwFlags, // motion and click options
DWORD dx, // horizontal position or change
DWORD dy, // vertical position or change
DWORD dwData, // wheel movement
ULONG_PTR dwExtraInfo // application-defined information
);
var
a:tpoint;
begin
a.X:=self.Left+button2.Left+10;
a.Y:=self.Top+ button2.Top+35;
setcursorpos(a.x,a.y);
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
//mouse_event(MOUSEEVENTF_RIGHTDOWN,0,0,0,0);
//mouse_event(MOUSEEVENTF_RIGHTUP,0,0,0,0);
end;procedure TForm1.Button2Click(Sender: TObject);
begin
showmessage('click');
end;