I need to get background color by known coord in c++. I tried to use ReadConsoleOutputAttribute from windows.h, but i didn't work. Here is my code:
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD count;
COORD cursor = { this->X, this->Y };
LPWORD *lpAttr = new LPWORD;
CONSOLE_SCREEN_BUFFER_INFO info;
GetConsoleScreenBufferInfo(console, &info);
ReadConsoleOutputAttribute(console, *lpAttr, 1, cursor, &count);
What's wrong here and what's the way to fix it? Do I suppose to get background color from lpAttr or what?