1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Strange behavior with my newest machine

Discussion in 'Plugins' started by vefatica, Aug 27, 2009.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,971
    Likes Received:
    30
    My CONSIZE command (4CONSOLE) is old and has always worked well. But it behaves oddly on my new machine (2.66 GHz, Core2 Quad). This routine is called twice in succession, once for horizontal resizing and once for vertical. Without the (odd-looking, "s(100)") Sleep() it misbehaves when resizing vertically, the second SetConsoleWindowInfo() undoing what the first one did.

    Code:
    INT s(DWORD n)
    {
        Sleep(n);
        return 1;
    }
    
    VOID ResizeUtil(HANDLE hCon, SMALL_RECT* psr, COORD cd, BOOL bDoWindow, BOOL bWindowFirst, BOOL bDoBuffer) {
        if (   ( bDoWindow && bWindowFirst && !SetConsoleWindowInfo(hCon, TRUE, psr) )
            || ( s(100) && bDoBuffer && !SetConsoleScreenBufferSize(hCon, cd) )
            || ( bDoWindow && !bWindowFirst && !SetConsoleWindowInfo(hCon, TRUE, psr) )
        );
    }
    
    Have you ever run into such a phenomenon? Do you have any guesses why that might happen?
     
  2. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,870
    Likes Received:
    83
    vefatica wrote:

    I run into that sort of thing constantly -- the Windows console manager
    has problems when you send commands to it too quickly. (They get
    executed out of order or dropped completely.)

    Rex Conn
    JP Software
     
  3. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,971
    Likes Received:
    30
    Do you have any better way of dealing with it than little timing kludges like mine? Any Sleep() (except Sleep(0)) makes my example work correctly.
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,870
    Likes Received:
    83
    vefatica wrote:

    No; I add delays of various lengths.

    Rex Conn
    JP Software
     

Share This Page