Solved

control mouse cursor move and click

Posted on 2002-04-27
3
326 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert Jpg /PNG To GIF 5 149
Delphi XE10, MySQL Query 4 164
Why can't I create any project with my delphi EXE file? 6 39
update joined tables 2 55
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

808 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