Solved

Mouse cursor position functions

Posted on 1998-09-01
5
165 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now