|
|
1.1.1.3 ! root 1: ! 2: /******************************************************************************\ ! 3: * This is a part of the Microsoft Source Code Samples. ! 4: * Copyright (C) 1993 Microsoft Corporation. ! 5: * All rights reserved. ! 6: * This source code is only intended as a supplement to ! 7: * Microsoft Development Tools and/or WinHelp documentation. ! 8: * See these sources for detailed information regarding the ! 9: * Microsoft samples programs. ! 10: \******************************************************************************/ ! 11: 1.1 root 12: #include <windows.h> 13: #include <stdio.h> 1.1.1.3 ! root 14: #include <conio.h> 1.1 root 15: #include "console.h" 16: 17: /******************************************************************* 18: * FUNCTION: demoConInfo(HANDLE hConOut) * 19: * * 20: * PURPOSE: demonstrate GetConsoleScreenBufferInfo. Get the current * 21: * console screen buffer information and display it on the * 22: * console. * 23: * * 24: * INPUT: console handle to output to * 25: *******************************************************************/ 26: 27: void demoConInfo(HANDLE hConOut) 28: { 29: BOOL bSuccess; 30: CONSOLE_SCREEN_BUFFER_INFO csbi; 31: CHAR szTemp[128]; 32: 33: setConTitle(__FILE__); 1.1.1.3 ! root 34: myPuts(hConOut, "For information on the console buffer, we need to call\n" ! 35: "GetConsoleScreenBufferInfo. Make any adjustments to the\n" ! 36: "screen buffer/console window now, then hit return...\n"); ! 37: myGetchar(); 1.1 root 38: bSuccess = GetConsoleScreenBufferInfo(hConOut, &csbi); 39: PERR(bSuccess, "GetConsoleScreenBufferInfo"); 1.1.1.3 ! root 40: myPuts(hConOut, "\nHere is the information on the buffer returned in the\n" ! 41: "CONSOLE_SCREEN_BUFFER_INFO structure:"); 1.1 root 42: sprintf(szTemp, "Size: X = %d, Y = %d", csbi.dwSize.X, csbi.dwSize.Y); 43: myPuts(hConOut, szTemp); 44: sprintf(szTemp, "Cursor pos: X = %d, Y = %d", csbi.dwCursorPosition.X, 45: csbi.dwCursorPosition.Y); 46: myPuts(hConOut, szTemp); 47: sprintf(szTemp, "Character display attribute: 0x%04x", csbi.wAttributes); 48: myPuts(hConOut, szTemp); 49: sprintf(szTemp, "Window position: Left = %d, Right = %d, Top = %d, " 50: "Bottom = %d", csbi.srWindow.Left, csbi.srWindow.Top, 51: csbi.srWindow.Right, csbi.srWindow.Bottom); 52: myPuts(hConOut, szTemp); 53: sprintf(szTemp, "Maximum window size: X = %d, Y = %d", 54: csbi.dwMaximumWindowSize.X, csbi.dwMaximumWindowSize.Y); 55: myPuts(hConOut, szTemp); 1.1.1.3 ! root 56: myPuts(hConOut, "\nHit any key to return..."); 1.1 root 57: myGetchar(); 58: return; 59: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.