?
Solved

control mouse cursor move and click

Posted on 2002-04-27
3
Medium Priority
?
342 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 200 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

752 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