Thread: Why is FillConsoleOutputAttribute returning false?

  1. #1
    Registered User manofsteel972's Avatar
    Join Date
    Mar 2004
    Posts
    317

    Why is FillConsoleOutputAttribute returning false?

    Code:
    void ScreenColorFill(HANDLE hStdout,DWORD Attributes)
    { 
    COORD MaxWindowSize=GetLargestConsoleWindowSize(hStdout);
    assert(MaxWindowSize.X&&MaxWindowSize.Y);
    DWORD num;
    COORD start;
    start.X=0;
    start.Y=0;
    bool test=FillConsoleOutputAttribute(hStdout,Attribute,(MaxWindowSize.X*MaxWindowSize.Y),start,&num);
    assert(test);
    perror(strerror(GetLastError() ) );
    }
    When I compile the code I get an assert. The GetLastError() function returns a message not enough space?? The code still fills the screen and errno contains no error. The function is supposed to return non zero on success. Just curious what is going on. Anyone have any ideas?

    [edit]
    nevermind i figured it out. I actually wrote the correct code here what I was compiling though was
    Code:
    void ScreenColorFill(HANDLE hStdout,DWORD Attributes)
    { 
    COORD MaxWindowSize=GetLargestConsoleWindowSize(hStdout);
    assert(MaxWindowSize.X&&MaxWindowSize.Y);
    LPDWORD lpnum;  //<-----was using the pointer version instead of DWORD
    COORD start;
    start.X=0;
    start.Y=0;
    bool test=FillConsoleOutputAttribute(hStdout,Attribute,(MaxWindowSize.X*MaxWindowSize.Y),start,lpnum);
    assert(test);
    perror(strerror(GetLastError() ) );
    }
    Last edited by manofsteel972; 09-29-2004 at 06:11 PM.
    "Knowledge is proud that she knows so much; Wisdom is humble that she knows no more."
    -- Cowper

    Operating Systems=Slackware Linux 9.1,Windows 98/Xp
    Compilers=gcc 3.2.3, Visual C++ 6.0, DevC++(Mingw)

    You may teach a person from now until doom's day, but that person will only know what he learns himself.

    Now I know what doesn't work.

    A problem is understood by solving it, not by pondering it.

    For a bit of humor check out xkcd web comic http://xkcd.com/235/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. the chess project
    By Hussain Hani in forum Projects and Job Recruitment
    Replies: 8
    Last Post: 05-28-2007, 02:33 AM
  2. C++ FTP class won't work
    By lord mazdak in forum C++ Programming
    Replies: 8
    Last Post: 12-18-2005, 07:57 AM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. opengl help
    By heat511 in forum Game Programming
    Replies: 4
    Last Post: 04-05-2004, 01:08 AM