DOCUMENT:Q198589 26-JUL-2002 [visualc] TITLE :HOWTO: Determine Justification in a ListView Control PRODUCT :Microsoft C Compiler PROD/VER::4.0,4.1,4.2,5.0,6.0 OPER/SYS: KEYWORDS:kbCtrl kbVC400 kbVC410 kbVC420 kbVC500 kbVC600 ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual C++, versions 4.0, 4.1 - Microsoft Visual C++, 32-bit Enterprise Edition, versions 4.2, 5.0, 6.0 - Microsoft Visual C++, 32-bit Professional Edition, versions 4.2, 5.0, 6.0 - Microsoft Visual C++, 32-bit Learning Edition, version 6.0 - Microsoft Visual C++.NET (2002) ------------------------------------------------------------------------------- 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; } } (c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Isaac Leon Varon, Microsoft Corporation Additional query words: justify CListView CListCtrl ====================================================================== Keywords : kbCtrl kbVC400 kbVC410 kbVC420 kbVC500 kbVC600 Technology : kbVCsearch kbVC400 kbAudDeveloper kbVC410 kbVC420 kbVC500 kbVC600 kbVC32bitSearch kbVC500Search Version : :4.0,4.1,4.2,5.0,6.0 Issue type : kbhowto ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 2002.