Advertisement

How to change the mouse position?

Started by June 30, 2000 02:53 PM
3 comments, last by Spark 24 years, 5 months ago
Hi, How do I change the position of the mouse cursor (windows, vc++)? For example placing the cursor at location (100; 100) and pressing the mouse button from inside a program. anyone? // Spark
hi
use SetCursorPos(int x,int y);
happy coding
lunasol
Advertisement
How to press the mouse button?
I think you''d need to send the WM_LBUTTONDOWN message if you want to send a left-button click and a WM_RBUTTONDOWN message if you want to send a right-button click.

========================================================
If something sounds stupid but works, it's not stupid
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
quote: Original post by Spark

How to press the mouse button?


Look up mouse_event() in MSDN.

<update>
Some examples for you:

        // Left click with mouse_event():mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);// Right click:mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);    


This has not been testen, but it should work.
</updtate>

- Muzzafarath

Mad House Software
The Field Marshals

Edited by - Muzzafarath on July 1, 2000 6:21:33 AM

Edited by - Muzzafarath on July 1, 2000 6:22:30 AM
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall

This topic is closed to new replies.

Advertisement