Mega Code Archive

 
Categories / Delphi / Examples
 

Position the mouse on my form

Use the function ClientToScreen to transfer the coordinates which are relative to your form window rather into screen coordinates. (Basically, the your form's x and y coordinate are added to your relative values). For example, point (0, 0) would be the left upper corner of your form. procedure PlaceMouse(x, y: word); var tp: TPoint; begin tp := ClientToScreen(point(x, y)); SetCursorPos(tp.x, tp.y); end;