"WriteConsoleOutput" Flood Screen?

Started by
1 comment, last by Colin Jeanne 18 years, 7 months ago
I want to flood the console screen with solid colors, but I have a problem: it's not flooding correctly, actually, not at all. My code looks correct, but it's not printing how I want it to. I think that it's going off of the console window. Any help? Here's my code:
void FloodScreen(WORD Props)
{
     bool Done = false;
     int DBHEX = 219;
     CHAR_INFO Flood;
     Flood.Char.AsciiChar = DBHEX;
     Flood.Attributes = Props;
     COORD BufferSize = {80,25};
     COORD CPos = {0,0};
     SMALL_RECT WArea = {0,0,0,0};
     while (!Done)
     {
           WriteConsoleOutput(wHnd, &Flood, BufferSize, CPos, &WArea);
           if (CPos.X >= -80)
           {
                CPos.Y += 1;
                CPos.X = 0;
           }
           CPos.X -= 1;
           if (CPos.Y >= 26)
           {
                Done = true;
           }
     }
}
(To call this function, I use FloodScreen(FOREGROUND_RED); Also, you must include windows.h, stdio.h, and stdlib.h.)
The best thing to do is just choose whatever you think you'd prefer, and go for it. -Promit
Advertisement
and here your answer shall be: benryve's notes

[Edited by - Gor435 on August 21, 2005 9:40:28 PM]
Gor435 - My Journal - MySpace - Facebook
WArea is incorrect.

Quote:WriteConsoleOutput()
The rectangle pointed to by the lpWriteRegion parameter specifies the size and location of the block to be written to in the console screen buffer.

This topic is closed to new replies.

Advertisement