Expand Minimize

ListView_GetStringWidth macro

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


int ListView_GetStringWidth(
  HWND hwnd,
  LPCSTR psz
);

Parameters

hwnd

Type: HWND

A handle to the list-view control.

psz

Type: LPCSTR

A pointer to a null-terminated string.

Return value

Returns the string width if successful, or zero otherwise.

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

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Commctrl.h

 

 

Community Additions

ADD
Show:
© 2014 Microsoft