ListView_GetStringWidth macro (commctrl.h)

Determines the width of a specified string using the specified list-view control's current font. You can use this macro or send the LVM_GETSTRINGWIDTH message explicitly.

Syntax

void ListView_GetStringWidth(
   hwndLV,
   psz
);

Parameters

hwndLV

Type: HWND

A handle to the list-view control.

psz

Type: LPCSTR

A pointer to a null-terminated string.

Return value

None

Remarks

The ListView_GetStringWidth macro returns the exact width, in pixels, of the specified string. If you use the returned string width as the column width in a call to the ListView_SetColumnWidth macro, the string will be truncated. To retrieve the column width that can contain the string without truncating it, you must add padding to the returned string width.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header commctrl.h