Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Mouse cursor on a defined position

Posted on 1999-07-12
5
Medium Priority
?
142 Views
Last Modified: 2010-04-06
How to put the mouse cursor on a defined position (X,Y) ?
0
Comment
Question by:F31203
[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
5 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 30 total points
ID: 1387897
hi
you use:

SetCusrorPos(x,y);

Regards Barry
0
 

Author Comment

by:F31203
ID: 1387898
Could you please tell me why, with this code, the cursor does not appear in the center of the form ?  (in the 'cross' s center)

Canvas.MoveTo((clientWidth div 2),0);
canvas.LineTo((clientWidth div 2),clientHeight);
Canvas.MoveTo(0, (clientHeight div 2));
canvas.LineTo(clientWidth,(clientHeight div 2));
SetCursorPos((clientWidth div 2), (clientHeight div 2));

Thanks,

Pascal

0
 
LVL 17

Expert Comment

by:inthe
ID: 1387899
not really no but the following worked for me but only on a full screen app???

begin
Canvas.MoveTo((clientWidth div 2),0);
canvas.LineTo((clientWidth div 2),clientHeight);
Canvas.MoveTo(0,(clientHeight div 2));
canvas.LineTo(clientWidth,(clientHeight div 2));
SetCursorPos((Form1.width div 2), (Form1.Height div 2));
end;

strange huh??
0
 
LVL 1

Expert Comment

by:pede
ID: 1387900
Hi

I haven't tried, but isn't SetCursorPos relative to the screen, and not to the form?

Then

SetCursorPos((Form1.width div 2)+Form1.Left, (Form1.Height div 2)+Form1.Top);

would be correct... And that's why the above would work on a fullscreen app ;)

/Pede

0
 
LVL 17

Expert Comment

by:inthe
ID: 1387901
good comment
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

705 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