Hey, i am using mouse_event function to simulate mouse input, but when i set the mouse position it moves very litlle, the values i used are the in the range of my screen resolution [0x0 - 1440x900]. What should i do?
Printable View
Hey, i am using mouse_event function to simulate mouse input, but when i set the mouse position it moves very litlle, the values i used are the in the range of my screen resolution [0x0 - 1440x900]. What should i do?
I think you need to explain a little more... I don't get the big picture.
What are you trying to do?
Ah, sorry :P
Im trying to set the mouse position at some position on the screen, but when i set like 900x350, the mouse dont appear at the position i wished, it appears in 50x10 (hipothetical values :P ).
And how are you setting the mouse position?
Where dot1.X is between 0.0f and 1.0f, and same for dot1.Y.Code:RECT resolution;
HWND desktop = GetDesktopWindow();
GetWindowRect(desktop, &resolution);
int width = resolution.right;
int height = resolution.bottom;
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, (dot1.X) * width, (1.0f - dot1.Y) * height, 0, 0);
If you want the set the mouse's coordinates on the screen, use SetCursorPos.
Yes, i tried that but if i use SetCursorPos inside a game the cursor just dont answer, and that isnt true with mouse_event.
After reading the remarks: "If MOUSEEVENTF_ABSOLUTE value is specified, dx and dy contain normalized absolute coordinates between 0 and 65,535. The event procedure maps these coordinates onto the display surface. Coordinate (0,0) maps onto the upper-left corner of the display surface, (65535,65535) maps onto the lower-right corner."
Thats for me to learn that i should always read remarks :P. Thank you =)