Microsoft KB Archive/198589

= How to determine justification in a ListView control in Visual C++ =

Article ID: 198589

Article Last Modified on 1/11/2006

-

APPLIES TO


 * Microsoft Visual C++ 4.0 Standard Edition
 * Microsoft Visual C++ 4.1 Subscription
 * Microsoft Visual C++ 4.2 Enterprise Edition
 * Microsoft Visual C++ 5.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 4.2 Professional Edition
 * Microsoft Visual C++ 5.0 Professional Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition
 * Microsoft Visual C++ 2005 Express Edition
 * Microsoft Visual C++ .NET 2003 Standard Edition
 * Microsoft Visual C++ .NET 2002 Standard Edition

-



This article was previously published under Q198589



Note Microsoft Visual C++ .NET 2002 and Microsoft Visual C++ .NET 2003 support both the managed code model that is provided by the Microsoft .NET Framework and the unmanaged native Microsoft Windows code model. The information in this article applies only to unmanaged Visual C++ code. Microsoft Visual C++ 2005 supports both the managed code model that is provided by the Microsoft .NET Framework and the unmanaged native Microsoft Windows code model.



SUMMARY
The documentation for the LVCOLUMN structure used by the ListView common control indicates that you can use the fmt member of the LVCOLUMN structure to set the justification of a column in the ListView control. This article shows you how to determine the value of the justification of a column in the ListView control.



MORE INFORMATION
Before you check the value of the fmt member of the LVCOLUMN structure, the value of this member must be bitwise "anded" with the flag LVCFMT_JUSTIFYMASK, which is defined in Commctrl.h. For example, the following code shows you how to determine whether the second column in a list view is right, center, or left justified: LVCOLUMN lvc; // Assume hWndOfLV is an HWND of an existing ListView control window. if(ListView_GetColumn(hWndOfLV, GetColumn, 1, &lvc)) {     switch(lvc.fmt & LVCFMT_JUSTIFYMASK) {        case LVCFMT_RIGHT: // Right justified break; case LVCFMT_CENTER: // Center justified break; case LVCFMT_LEFT: // Left justified break; }  }

Additional query words: justify CListView CListCtrl

Keywords: kbhowto kbctrl KB198589

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.