This site hosted by Free.ProHosting.com
Google

How can I change the cursor position?

Applies To: C++Builder 1 or higher
Category: Knowledge Base

I can determine the cursor position but how can I change it?
 
 1.
  Start a new project using File | New Application.
 
 2.
  Add a Button. Edit its OnClick event:
 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    SetCursorPos(0, 0);
}
 
The Win32 API function SetCursorPos allows you to set the cursor position.
 
Notes
· The cursor coordinates are screen based and not client based: the (0, 0) point is in the top left corner of the screen not the form.

C++Builder Developer's Network
Copyright © Yoto Yotov