COORD GetConsoleCursorPosition(HANDLE hConsoleOutput)
{
CONSOLE_SCREEN_BUFFER_INFO cbsi;
if (GetConsoleScreenBufferInfo(hConsoleOutput, &cbsi))
{
return cbsi.dwCursorPosition;
}
else
{
// The function failed. Call GetLastError() for details.
COORD invalid = { 0, 0 };
return invalid;
}
}
POINT p;
if (GetCursorPos(&p))
{
//cursor position now in p.x and p.y
}