Mega Code Archive

 
Categories / Delphi / Examples
 

Position the mouse on the screen

This is done with the API function SetCursorPos(x, y). Note: Since this function does not get a windows handle as a parameter, x, y have to be screen coordinates. Your component does use relative coordinates, e.g. relative to a TPanel or to the owning TForm. You may use the function ClientToScreen to calculate the proper screen coordinates.