2008. november 29., szombat

Simulate a mouse click on our form (control)


Problem/Question/Abstract:

Simulate a mouse click on our form (control)

Answer:

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);

Nincsenek megjegyzések:

Megjegyzés küldése