GetConsoleScreenBufferInfo

  BOOL GetConsoleScreenBufferInfo(hConsoleOutput, pcsbi)    
  HANDLE hConsoleOutput; /* identifies screen buffer */
  PCONSOLE_SCREEN_BUFFER_INFO pcsbi; /* receives screen info */

The GetConsoleScreenBufferInfo function retrieves information about the the specified console screen buffer.

Parameters

hConsoleOutput

Specifies an open handle with GENERIC_READ access to a console screen buffer.

pcsbi

Points to a CONSOLE_SCREEN_BUFFER_INFO structure in which the screen buffer information will be returned.

The CONSOLE_SCREEN_BUFFER_INFO structure has the following format:

typedef struct _CONSOLE_SCREEN_BUFFER_INFO { /* csbi */

COORD dwSize;

COORD dwCursorPosition;

WORD wAttributes;

SMALL_RECT srWindow;

COORD dwMaximumWindowSize;

} CONSOLE_SCREEN_BUFFER_INFO ;

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

The srWindow rectangle returned in the CONSOLE_SCREEN_BUFFER_INFO structure can be modified and then passed in to SetConsoleWindowInfo to scroll the screen buffer in the window and/or to change the size of the window.

All coordinates returned in the CONSOLE_SCREEN_BUFFER_INFO structure are in character cell coordinates, where the origin (0, 0) is at the top-left corner of the screen buffer.