+ 1
Cursor position in C++
can you help me with setting the cursor position in C++?
7 Respostas
+ 2
If you mean move the cursor in the console window then check out these windows functions:
https://docs.microsoft.com/en-us/windows/console/getstdhandle
( you would need the STD_OUTPUT_HANDLE )
and
https://docs.microsoft.com/en-us/windows/console/setconsolecursorposition
which requires the previous handle as an argument, together with the coordinates.
If you mean move the mouse cursor outside the console window, check out:
https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setcursorpos
Also don't forget to include the <windows.h> header.
If you need an example, just ask. :)
+ 1
Check XWarpPointer of X11 library(i think its not for windows)
+ 1
Awais Ahmed
Nope, you can only access that through the operating system's API.
The standard library provides no such functionality.
0
thanks, but I use Windows
0
Does windows.h also counts in c++ standard library? What if program has the linux environment
0
Awais Ahmed
windows.h is not part of the standard.
For linux there is:
https://en.m.wikipedia.org/wiki/Unistd.h
0
Is it possible to control the cursor by only using C++ standard library?
Without any external library