CSTextWidth Function


Consoul internally uses the DrawText Win32 API function to display text blocks.

CSTextWidth is a wrapper around DrawText. It doesn't support vt100 escapes, they are not parsed here and are just passed as is to DrawText.


VB/A 32bits

Private Declare Function CSTextWidth Lib "consoul_010205_32.dll" ( _
  ByVal hWnd As Long, _
  ByVal lpszText As Long, _
  ByVal lDTFlags As Long _
) As Integer

VB/A 64bits

Private Declare PtrSafe Function CSTextWidth Lib "consoul_010205_64.dll" ( _
  ByVal hWnd As LongPtr, _
  ByVal lpszText As LongPtr, _
  ByVal lDTFlags As Long _
) As Integer

Return Value

The return value is the with of the text as computed by the DrawText Win32 API function, with the font that the Consoul window uses, not considering font attributes (like bold or italic).



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


The text for which to compute the width. VT100 escapes sequences are not supported.


Flags to pass to the DrawText Win32 API function. If 0 (zero), Consoul will use its default flags: DT_SINGLELINE Or DT_NOPREFIX Or DT_LEFT.

Last updated: May 13 2022.