Solved

control mouse cursor move and click

Posted on 2002-04-27
3
330 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 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