|
Borland C ++ Builder FAQ
|
||
| The content | The last update: 14.02.2004 | |
|
How to learn or change mouse cursor position? How to emulate pushings of mouse buttons? The author: OlegGG SetCursorPos (random (Screen-> Width), random (Screen-> Height)); To learn cursor coordinates it is possible so: POINT cur_pos; GetCursorPos (&cur_pos); Then cur_pos.x - coordinate on х, and cur_pos.y - On yButton click emulation in current coordinates of the cursor: mouse_event (MOUSEEVENTF_LEFTDOWN, 0,0,0,0);//pushed the left mouse button mouse_event (MOUSEEVENTF_LEFTUP, 0,0,0,0);//released the left mouse button (NOT to FORGET)Similarly with the right button, but the flag is equal: MOUSEEVENTF_RIGHTDOWN And MOUSEEVENTF_RIGHTUP accordingly With the average button: MOUSEEVENTF_MIDDLEDOWN And MOUSEEVENTF_MIDDLEUP accordingly 2nd and 3rd function parameters mouse_event - mouse coordinates. At flag MOUSEEVENTF_MOVE - offset in pixels from a current point and if flag MOUSEEVENTF_ABSOLUTE it is necessary to transfer coordinates in an absolute format is installed. It is possible to translate so: cur_pos.x = cur_pos.x * (65535 / Screen-> Height); cur_pos.y = cur_pos.y * (65535 / Screen-> Height); |