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

x
?
Solved

Mouse cursor position functions

Posted on 1998-09-01
5
Medium Priority
?
172 Views
Last Modified: 2010-05-18
Hi.
What are Delphi functions equivalent
to C++ GetCursorPos and SetCursorPos?
thanks
0
Comment
Question by:duke_n
[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 5

Expert Comment

by:Tom 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

Industry Leaders: 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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

721 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