Link to home
Start Free TrialLog in
Avatar of duke_n
duke_n

asked on

Mouse cursor position functions

Hi.
What are Delphi functions equivalent
to C++ GetCursorPos and SetCursorPos?
thanks
Avatar of Tom Knowlton
Tom Knowlton
Flag of United States of America image

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.
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);
}

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
Avatar of duke_n
duke_n

ASKER

Thanks Viktor!
that works fine.
ASKER CERTIFIED SOLUTION
Avatar of viktornet
viktornet
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial