1COORD GetConsoleCursorPosition(HANDLE hConsoleOutput)
2{
3 CONSOLE_SCREEN_BUFFER_INFO cbsi;
4 if (GetConsoleScreenBufferInfo(hConsoleOutput, &cbsi))
5 {
6 return cbsi.dwCursorPosition;
7 }
8 else
9 {
10 // The function failed. Call GetLastError() for details.
11 COORD invalid = { 0, 0 };
12 return invalid;
13 }
14}
15
1POINT p;
2if (GetCursorPos(&p))
3{
4 //cursor position now in p.x and p.y
5}