CSGetMaxVisibleCols Function

Description

Gets the maximum number of visible columns for the current size of the console windows. This is computed simply by dividing the window width with the font reported average character width, as returned by CSGetCharWidth.

However, only true monospaced fonts use the same width to display each of their character, so this function may be useful only when used with console windows created with such a font.

Syntax

VB/A 32bits

Private Declare Function CSGetMaxVisibleCols Lib "consoul_010205_32.dll" ( _
  ByVal hWnd As Long _
) As Integer

VB/A 64bits

Private Declare PtrSafe Function CSGetMaxVisibleCols Lib "consoul_010205_64.dll" ( _
  ByVal hWnd As LongPtr _
) As Integer

Return Value

The return value is the number of visible columns based on the average character width of the Consoul window selected font, counting one for the last displayable character even if it may be only partially visible.

Parameters

hWnd

The window handle (HWND) of the Consoul window, as returned by CSCreateLogWindow.

Remarks

See CSGetMaxVisibleRows to get the always correct number of visible rows based on the current Consoul window height; the character height doesn't change for a font, monospaced or not.

Last updated: May 13 2022.