Annotation of mstools/samples/console/coninfo.c, revision 1.1

1.1     ! root        1: #include <windows.h>
        !             2: #include <stdio.h>
        !             3: #include "console.h"
        !             4: 
        !             5: /*******************************************************************
        !             6: * FUNCTION: demoConInfo(HANDLE hConOut)                            *
        !             7: *                                                                  *
        !             8: * PURPOSE: demonstrate GetConsoleScreenBufferInfo. Get the current *
        !             9: *          console screen buffer information and display it on the *
        !            10: *          console.                                                *
        !            11: *                                                                  *
        !            12: * INPUT: console handle to output to                               *
        !            13: *******************************************************************/
        !            14: 
        !            15: void demoConInfo(HANDLE hConOut)
        !            16: {
        !            17:   BOOL bSuccess;
        !            18:   CONSOLE_SCREEN_BUFFER_INFO csbi;
        !            19:   CHAR szTemp[128];
        !            20: 
        !            21:   setConTitle(__FILE__);
        !            22:   bSuccess = GetConsoleScreenBufferInfo(hConOut, &csbi);
        !            23:   PERR(bSuccess, "GetConsoleScreenBufferInfo");
        !            24:   myPuts(hConOut, "For information on the console buffer, we need to call\n"
        !            25:                   "GetConsoleScreenBufferInfo. Here is the information from\n"
        !            26:                   "the buffer returned, the CONSOLE_SCREEN_BUFFER_INFO:");
        !            27:   sprintf(szTemp, "Size: X = %d, Y = %d", csbi.dwSize.X, csbi.dwSize.Y);
        !            28:   myPuts(hConOut, szTemp);
        !            29:   sprintf(szTemp, "Cursor pos: X = %d, Y = %d", csbi.dwCursorPosition.X,
        !            30:       csbi.dwCursorPosition.Y);
        !            31:   myPuts(hConOut, szTemp);
        !            32:   sprintf(szTemp, "Character display attribute: 0x%04x", csbi.wAttributes);
        !            33:   myPuts(hConOut, szTemp);
        !            34:   sprintf(szTemp, "Window position: Left = %d, Right = %d, Top = %d, "
        !            35:       "Bottom = %d", csbi.srWindow.Left, csbi.srWindow.Top,
        !            36:       csbi.srWindow.Right, csbi.srWindow.Bottom);
        !            37:   myPuts(hConOut, szTemp);
        !            38:   sprintf(szTemp, "Maximum window size: X = %d, Y = %d",
        !            39:       csbi.dwMaximumWindowSize.X, csbi.dwMaximumWindowSize.Y);
        !            40:   myPuts(hConOut, szTemp);
        !            41:   myPuts(hConOut, "\nHit enter to return...");
        !            42:   myGetchar();
        !            43:   return;
        !            44: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.