Thread: Creating Listview in Report Mode with WinAPI

  1. #1
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138

    Creating Listview in Report Mode with WinAPI

    How can I create a listview in report mode with the win32API? Just a little snippet of code. I don't need an entire wndproc/

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Look for WM_NOTIFY msg's
    Code:
    // create the list view
    hLV_Wnd=CreateWindow("SysListView32",NULL,WS_CHILD | WS_VISIBLE   | LVS_REPORT   | WS_BORDER | WS_VSCROLL | WS_EX_RIGHTSCROLLBAR | WS_TABSTOP  ,0 ,0 , iWidth, iHeight, hParent, (HMENU)iCtrlID, hInst, NULL); 
    
    //insert a column, I use a loop
    //the fColRatio is a percentage (per column ie 0.25 for 4 equal)
    
    LV_COLUMN		LVColumn;
    
    LVColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT ; 
    LVColumn.fmt = LVCFMT_LEFT;
    LVColumn.cx=(int)(iWidth*fColRatio);
    LVColumn.pszText = sColTitle; 
    LVColumn.cchTextMax = lstrlen(sColTitle); 
    LVColumn.iSubItem = iNumCol; 		
    LVColumn.iImage = 0; 		
    LVColumn.iOrder = 0; 		
    ListView_InsertColumn( hLV_Wnd ,iNumCol ,&LVColumn );
    
    
    //add an item
    LV_ITEM			pItem;
    if(iColumn==0)//is new item
    {
         pItem.mask=LVIF_TEXT | LVIF_PARAM;
         pItem.iItem=Row;
         pItem.iSubItem=Column;
         pItem.state=0;
         pItem.stateMask=0;
         pItem.pszText=sDescription;
         pItem.cchTextMax=STRING;
         pItem.iImage=0;
         pItem.lParam=Row;
         ListView_InsertItem( hLV_hWnd, &pItem); 
    }
    else// is subitem
         ListView_SetItemText( hLV_hWnd, iRow, iColumn, sDescription);
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2009, 12:57 PM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  3. Moving Average Question
    By GCNDoug in forum C Programming
    Replies: 4
    Last Post: 04-23-2007, 11:05 PM
  4. ListView in Report mode help
    By @nthony in forum Windows Programming
    Replies: 3
    Last Post: 08-05-2006, 11:57 PM
  5. listview - report & showselectionalways
    By lobo in forum Windows Programming
    Replies: 3
    Last Post: 07-04-2002, 01:31 AM