Set Mouse X and Y in A Window

Just starting out? Need help? Post your questions and find answers here.
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 641
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Set Mouse X and Y in A Window

Post by captain_skank »

Hi,

Is there a way to set the x,y of the mouse cursor in a window without using the mouse library ??

I have a window that i use windowmousex and windowmousey to fake a mouse over but i'd like to set the inital position well away from these areas.

Thanks
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Set Mouse X and Y in A Window

Post by ts-soft »

Code: Select all

SetCursorPos_(x, y)
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 641
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: Set Mouse X and Y in A Window

Post by captain_skank »

dood - you are a lifesaver.

Funnily enough I was just flicking through the API but didn't register that setcursor would set the mouse position just the text cursor position.

Thanks
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: Set Mouse X and Y in A Window

Post by Shield »

The mouse pointer actually is called 'cursor' while the pointer for text is called 'caret'. :)
At least those are the terms that are used for WinAPI.
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Post Reply