Partager via


ListView_GetStringWidth

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This 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
    Handle to the list-view control.
  • psz
    Pointer to a null-terminated string.

Return Value

The string width indicates success. Zero indicates failure.

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 get the column width that can contain the string without truncating it, you must add padding to the returned string width.

Related message: LVM_GETSTRINGWIDTH

Requirements

Header commctrl.h
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

LVM_GETSTRINGWIDTH
List-View Controls Macros