Well this seems to a problem sometimes when someone asks us how to find where my cursor is currently located. Well why to say when we can infact show where actually is our mouse cursor at given point in time. To do this we will create a simple Delphi program as follows -
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils, Controls, Windows;
{$APPTYPE CONSOLE}
uses
SysUtils, Controls, Windows;
var
MyMouse : TMouse;
begin
MyMouse := TMouse.Create;
While True do
begin
WriteLn('(X, y) = (' + inttostr(TPoint(MyMouse.CursorPos).x) + ',' + inttostr(TPoint(MyMouse.CursorPos).y) + ')');
sleep(300);
end
end.
MyMouse : TMouse;
begin
MyMouse := TMouse.Create;
While True do
begin
WriteLn('(X, y) = (' + inttostr(TPoint(MyMouse.CursorPos).x) + ',' + inttostr(TPoint(MyMouse.CursorPos).y) + ')');
sleep(300);
end
end.
As we can see we create a simple Mouse cursor for ourselves in this small program and simply place it in a while loop of 300 ms to trace the current position of mouse cursor in our screen.
Simple isn't it?