# [C++] How to set cursor position?



## Show4Pro

Is there a code for C++ that could change your current cursor position and possibly click? Say I want to make a program that will move my cursor to a specified location on my desktop and click without actually having to move my mouse.

Thanks!
as always rep+ for helpful answers!


----------



## RyanRacer48

I think, one of the h files can be used for this purpose.
windows.h, and you have to implement the functionality yourself:
Help with Code Tags
(Toggle Plain Text)

#include <windows.h>

void gotoxy ( short x, short y )
{
COORD coord = {x, y};
SetConsoleCursorPosition ( GetStdHandle ( STD_OUTPUT_HANDLE ), coord );
}


----------

