the csbi.wAttributes are combinations of '|' operators,...

DWORD textcolor = csbi.wAttributes & 0xff0f;

DWORD backcolor = (csbi.wAttributes & 0xfff0) >> 4;

i understand the 0xff0f is a hexadecimal value(i don't know in decimal), but why these number and not other?

can anyone explain to me these 2 calculations?

(they are changed with SetConsoleTextAttribute() function)