Mega Code Archive

 
Categories / Delphi / Examples
 

Simulate a mouse click on our form [control]

This is easily done by position the mouse cursor onto the form using SetCursorPos, then using mouse_event to fake a mouse click. // click in upper-left corner, 50 pixels inward SetCursorPos (Form1.Left+50, Form1.Top+50); mouse_event (MOUSEEVENTF_LEFTDOWN, 0,0,0,0); mouse_event (MOUSEEVENTF_LEFTUP, 0,0,0,0);