Getting the number of columns in the report view


To get the number of columns in the list view control, we first get a pointer to the header control and then use the header control to query the number of columns it has.
CHeaderCtrl* pHeader = (CHeaderCtrl*) m_listctrl.GetDlgItem(0);
int nColumnCount = pHeader->GetItemCount();
This works even when the listview control has the LVS_NOCOLUMNHEADER style. It also works if the control is not in the report view.
 



Comments

  • Trade Rumor : chanel Described as An Absolute Must This morning

    Posted by incockDak on 03/29/2013 08:03am

    This is why everyone is extremely wrong surrounding gucci and consequently reasons why you have to ought to see this ebook. [url=http://growth-management.alachua.fl.us/comprehensive_planning/gucci.html]バック[/url] Different questions about gucci clarified and reasons why you has got to read in detail each concept of this specific documentation. [url=http://growth-management.alachua.fl.us/comprehensive_planning/saclongchamp.php]Sacs longchamp[/url] WuqGdqQheSqa [url=http://running-nike0.seesaa.net/]nike ランニング[/url]ZtzJanPmaDop [[url=http://free-nike-nikeo.seesaa.net/]nike free[/url]UbrPdlBbiClp [url=http://xn--nike-ul4c5c5fyqb.seesaa.net/]ナイキスニーカー[/url]GqpUvrLhnEpo [url=http://nikejapan0.seesaa.net/]ナイキスニーカー[/url]LlpXkoBeoUqp [url=http://nikesneakersjp.seesaa.net/]nike スニーカー[/url]HxkKocIszLps [url=http://nikegolf00.seesaa.net/]ナイキゴルフ[/url]GfqAaqKcwKrt [url=http://nikeshoes00.seesaa.net/]シューズナイキ[/url]ZkvTscAlfWns [url=http://sneaker-adidas-jp.seesaa.net/]スニーカー アディダス[/url]DjqEynIeyEry

    Reply
  • Just stop Complaining And Start your private nike shoes Distribution campaign Preferably

    Posted by expopmerm on 03/18/2013 01:54am

    The 12 MostWild adidas shoes Secrets and cheats... And The Way To Utilize them!!|Concise guide helps you with the ins and outs linked with nike shoes combined with things you want to undertake this afternoon.}[url=http://www.nikejapan.asia/]nike air[/url] Understand who's preaching about nike shoes and exactly why you ought to get worried. [url=http://www.adidasjapan.biz/]スニーカー adidas[/url] adidas shoes will give spanking new life span to the old dilemma. . . defacto standard The way in which gucci bags Made Me Famous And Rich [url=http://www.guccijp.asia/]gucci バッグ[/url] The best tool for chloe which you may understand about right away. [url=http://www.chloejp.biz/]財布 chloe[/url] The Amazing chanel bags Hack Who Can Fool Almost all [url=http://www.chaneljp.biz/]chanel バッグ[/url] Information on how to learn all the stuff there is to understand surrounding chanel in nine straight forward steps.The reasons why so many people are dead wrong regarding adidas shoes and as a result why you should certainly check this out post. [url=http://www.adidasjapan.asia/]adidas シューズ[/url] Whoa, amazing service. You must have a look at adidas shoes right now while it's still up for grabs ! ! [url=http://www.nikejp.biz/]nike running[/url] adidas shoes Counterfeits - A Really Wonderful nike shoes 'cheat' That experts claim Fools 97% of the customers

    Reply
  • A valid pointer to CHeaderCtrl object

    Posted by Legacy on 11/26/2003 12:00am

    Originally posted by: Mirko

    Work with the windows handle of class CHeaderCtrl to retrieve a valid pointer if the header window exists.
    // The pointer to my list control.
    extern CListCtrl* pMyListControl;

    // ThePointer to my header control
    CHeaderCtrl* pHeader = NULL;

    HWND hwndList = 0;
    HWND hwndHeader = 0;

    hwndList = pMyListControl->GetSafeHwnd();
    hwndHeader = ListView_GetHeader(hwndList); //macro use
    pHeader = (CHeaderCtrl*)FromHandle(hwndHeader);
    if(pHeader)
    int nColumnCount = pHeader->GetItemCount();

    Reply
  • Use GetHeaderCtrl

    Posted by Legacy on 11/06/2001 12:00am

    Originally posted by: Joost van den Boom

    Instead of using "m_listctrl.GetDlgItem(0)" use "m_listctrl.GetHeaderCtrl()" then it works fine!

    Joost

    Reply
  • Wrong number of columns.

    Posted by Legacy on 05/17/2000 12:00am

    Originally posted by: Alon

    I used this code to find out the numbers of columns I have in order to delete them. I got wrong number and I made the deletion in that way:
    
    

    while(m_ListCtrl.DeleteColumn(0) != 0);

    In that way I didn't have any problem!

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • When it comes to desktops – physical or virtual – it's all about the applications. Cloud-hosted virtual desktops are growing fast because you get local data center-class security and 24x7 access with the complete personalization and flexibility of your own desktop. Organizations make five common mistakes when it comes to planning and implementing their application management strategy. This eBook tells you what they are and how to avoid them, and offers real-life case studies on customers who didn't …

  • Live Event Date: April 22, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Database professionals — whether developers or DBAs — can often save valuable time by learning to get the most from their new or existing productivity tools. Whether you're responsible for managing database projects, performing database health checks and reporting, analyzing code, or measuring software engineering metrics, it's likely you're not taking advantage of some of the lesser-known features of Toad from Dell. Attend this live …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds