CSGetCharWidth Function

Description

Returns the average char width of the Consoul window font.

Syntax

VB/A 32bits

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

VB/A 64bits

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

Return Value

The return value is the average char width of the Consoul window font (specified at window creation time, see CSCreateLogWindow).

Parameters

hWnd

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

Remarks

Only true monospaced fonts use the same width to display each of their character. To get the maximum width a char occupies, use CSGetMaxCharWidth.

This function internally uses the Win32 GetTextMetrics API to query for font information and returns the tmAveCharWidth member of the TEXTMETRIC structure.

Last updated: May 13 2022.