Status & Roadmap
Authors & License
Funding Ultimate++
Search on this site
Search in forums

SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Set mouse position
Set mouse position [message #54339] Fri, 26 June 2020 00:22 Go to next message
raylan is currently offline  raylan
Messages: 1
Registered: June 2020
Junior Member
How to set the mouse position inside the window using u++?
Re: Set mouse position [message #54340 is a reply to message #54339] Fri, 26 June 2020 18:15 Go to previous messageGo to next message
Xemuth is currently offline  Xemuth
Messages: 188
Registered: August 2018
Location: France
Experienced Member
Hello Raylan,

From my knowledge,
if you want to set the cursor / mouse position you must use the OS api :

for windows :
https://docs.microsoft.com/en-us/windows/win32/api/winuser/n f-winuser-setcursorpos

Here you have one exemple (I use it to center mouse cursor on middle of my windows at every draw loop)
    SetCursorPos(topWindow->GetPos().x.GetA() + (GetSize().cx/2) +1,topWindow->GetPos().y.GetA() + (GetSize().cy/2)+1 );

Don't forget to include <Winuser.h>

For linux : I have no idea, maybe a quick google search will awnser your question

Re: Set mouse position [message #54341 is a reply to message #54340] Fri, 26 June 2020 23:40 Go to previous message
koldo is currently offline  koldo
Messages: 3145
Registered: August 2008
Ultimate Member
Hello Raylan

You can also check in package Bazaar/SysInfo, function Mouse_SetPos().
It works in Windows and Linux.

Best regards
Previous Topic: witz - handler with variable parameter
Goto Forum:

Current Time: Fri Jul 10 23:56:25 CEST 2020

Total time taken to generate the page: 0.00674 seconds