Solved

control mouse cursor move and click

Posted on 2002-04-27
3
323 Views
Last Modified: 2010-04-04
Hi,

does exist the possibility to remote control the mouse cursor and also the click/doubleclick..?

delphiheaven
0
Comment
Question by:delphiheaven
3 Comments
 
LVL 3

Accepted Solution

by:
589158 earned 50 total points
ID: 6973226
Hi,

1. Mouseposition
with the SetCursorPos(X,Y) function you can control the position. The SetCursorPos function moves the cursor to the specified screen coordinates. If the new coordinates are not within the screen rectangle set by the most recent ClipCursor function, Windows automatically adjusts the coordinates so that the cursor stays within the rectangle.

Example:
SetCursorPos(0,0);
This sets the cursor to the top left corner of the screen.


2. Mouseclicking

Following function "remote-leftclicks" on the current mouse-position:

mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)

And this for right mbutton:
mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);

And this for middle mbutton:
mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0);


So if you want to doubleclick, you must use the following code:
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)


Hope that helps!

greets,
UTA
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 6973687
I suggest using the Mouse variable in D6 (and later newer versions) because of cross-platform compatibility
0
 
LVL 1

Expert Comment

by:pnh73
ID: 9004194
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept answer from 589158

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Sending Gmail through Delphi 3 69
Using idhttp to login to instagram 2 65
Help on project with Soap 10 44
find a node in VST 2 47
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now