Solved

Mouse cursor position functions

Posted on 1998-09-01
5
168 Views
Last Modified: 2010-05-18
Hi.
What are Delphi functions equivalent
to C++ GetCursorPos and SetCursorPos?
thanks
0
Comment
Question by:duke_n
  • 3
5 Comments
 
LVL 5

Expert Comment

by:knowlton
ID: 1338403
I don't have Delphi in front of me right now, but I know that most components should have an OnMouseMove event under the EVENTS tab in the Object Inspector.  Among the parameters passed in to this procedure are an X and Y which represent the X and Y positon of the cursor, either respective to the form or the component.

As far as SetCursorPos in Delphi...if I had my help in front of me...darn.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1338404
var
  Pt : TPoint;
begin
  GetCursorPos(pt);
  ShowMessage('X-Coord'+IntToStr(pt.x)+', Y-Coord'+IntToStr(pt.y));//Display coordinates
  SetCursorPos(pt);//if mouse have moved it will return it to the same place as before
end;

I don't know how to implement the TPoint in C++...maybe something like this...This is for Builder C++ , right?

POINT pt;
{
  GetCursorPos(pt);
  SetCursorPos(pt);
}

0
 
LVL 10

Expert Comment

by:viktornet
ID: 1338405
I mean .....still not sure if this is the way C++ implements Point variable

{
  POINT pt;
    GetCursorPos(pt);
    SetCursorPos(pt);
}

If you have other questions ask ;-)

Regards,
Viktor Ivanov
0
 
LVL 1

Author Comment

by:duke_n
ID: 1338406
Thanks Viktor!
that works fine.
0
 
LVL 10

Accepted Solution

by:
viktornet earned 0 total points
ID: 1338407
Ok, great
Still if you have any other questions just ask ;-)

Regards,
Viktor Ivanov
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
Delphi selector screen 2 84
Moving (cutting/pasting) controls in a TTabbedNotebook... 7 44
DBGrid or StringGrid ? 6 105
Wincontrol not (correctly) drawn 15 42
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

830 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