mercredi 1 avril 2015

Writting Color to windows Console using WriteConsoleOutputAttribute

I'm writing an application that paints to the windows console. Every time i use the WriteConsoleOutputAttribute function it doesn't seem to write to the console correctly.


see use below:



#include <Windows.h>
int main()
{
WORD color = BACKGROUND_BLUE;
DWORD charwritten;
WriteConsoleOutputAttribute(GetStdHandle(STD_OUTPUT_HANDLE), &color, 5, { 1, 1 }, &charwritten);
}


This is a little dummy program i wrote to just see if the function works in the console, it does display the color to the console, but as stated in the code WORD color = FOREGROUND_BLUE; it's anything but blue, normally it's a range of colors and I can't seem to find out why this happens...


Aucun commentaire:

Enregistrer un commentaire