How do I find the coordinates of the cursor in a console window?

Viewed 13151

I gave the cursor some coordinates using the following code:

COORD c = { 7, 7 };
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(h, c); 

Now I'm writing some text on the screen, and I want to know the current location of the cursor.

The only function I found was using POINT and not COORD. So I wrote:

VOID KeyEventProc(KEY_EVENT_RECORD ker)
{
    POINT position;
    GetCursorPos(&position);

        if (position.y<14 && position.x<9){
            if (ker.bKeyDown)
                printf("%c", ker.uChar);
        }

}

But the POINT doesn't give the same values as I need. How can I convert it? Or what is the function for getting the current COORD?

1 Answers
Related