• clearing screen

    From mutazilah@gmail.com@21:1/5 to All on Fri Nov 20 19:24:16 2020
    Here is the code that I ended up using, which works
    on both Windows 10 and HX DOS (previously I used
    -1 for length which didn't work on HX DOS):

    CONSOLE_SCREEN_BUFFER_INFO Console;
    COORD dwCursorPosition;
    DWORD written;

    /* Position cursor at the top of buffer */
    dwCursorPosition.X = 0;
    dwCursorPosition.Y = 0;
    SetConsoleCursorPosition(hOutput, dwCursorPosition);

    /* get a ptr to the output screen buffer */
    GetConsoleScreenBufferInfo(hOutput, &Console);

    /* clear screen */
    FillConsoleOutputCharacter(hOutput,
    ' ',
    (DWORD)Console.dwSize.Y * Console.dwSize.X,
    dwCursorPosition,
    &written);

    FillConsoleOutputAttribute(hOutput,
    FOREGROUND_BLUE
    | FOREGROUND_GREEN
    | FOREGROUND_RED,
    (DWORD)Console.dwSize.Y * Console.dwSize.X,
    dwCursorPosition,
    &written);

    Then this is set correctly (thanks to the positioning to 0/0):

    /* let MicroEMACS know our starting screen size */
    term.t_nrow = Console.srWindow.Bottom;
    term.t_ncol = Console.srWindow.Right + 1;


    BFN. Paul.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)