Why is FillConsoleOutputAttribute returning false?

This is a discussion on Why is FillConsoleOutputAttribute returning false? within the Windows Programming forums, part of the Platform Specific Boards category; 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() ) ...

  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 07: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, 03: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, 01:34 PM
  4. opengl help
    By heat511 in forum Game Programming
    Replies: 4
    Last Post: 04-05-2004, 02:08 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21