Results 1 to 16 of 16

Thread: Listview

  1. #1

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335

    Listview

    I searched on msdn on list view but i get these complex sample which i cant understand can some teach me or post some code on :

    How to create a listview
    how to create columns
    how to add info to the columns and
    how to get info from them
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  2. #2
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394
    Adding a new column:

    Code:
    void Lv_AddColumn(HWND hWnd, LPSTR lpText, UINT uWidth, UINT uID)
    {
    	//variable
    	LVCOLUMN lvc;
    
    	//create item
    	lvc.mask = LVCF_TEXT | LVCF_WIDTH;
    	lvc.pszText = lpText;
    	lvc.cx = uWidth;
    
    	//insert column
    	ListView_InsertColumn(hWnd, uID, &lvc);
    }
    VS.NET 2003

    Need to email me?

  3. #3

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    thanks but i would i create the listview to use that with>?
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  4. #4
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394
    Here you go:

    Code:
    	hList = CreateWindowEx(WS_EX_CLIENTEDGE, "SysListView32", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | LVS_REPORT, 0, 0, 0, 0, hWnd, NULL, hInst, 0);
    VS.NET 2003

    Need to email me?

  5. #5

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    i get a error on LVS_REPORT
    VB Code:
    1. E:\Program Files\Microsoft Visual Studio\MyProjects\Menu1\Main.cpp(72) : error C2065: 'LVS_REPORT' : undeclared identifier
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  6. #6
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394
    Did you include commctrl.h and import comctl32.lib?
    VS.NET 2003

    Need to email me?

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    And you must call InitializeCommonControls or InitializeCommonControlsEx
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  8. #8

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    how do i import that comctl32.lib?
    and how do i call InitializeCommonControls
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  9. #9

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    with the code below . what is the UINT uID?
    VB Code:
    1. void Lv_AddColumn(HWND hWnd, LPSTR lpText, UINT uWidth, UINT uID)
    2. {
    3.     //variable
    4.     LVCOLUMN lvc;
    5.  
    6.     //create item
    7.     lvc.mask = LVCF_TEXT | LVCF_WIDTH;
    8.     lvc.pszText = lpText;
    9.     lvc.cx = uWidth;
    10.  
    11.     //insert column
    12.     ListView_InsertColumn(hWnd, uID, &lvc);
    13. }
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  10. #10

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    i see the column part but cant seem to add column
    VB Code:
    1. #define IDC_MAIN_HLIST  102
    VB Code:
    1. hList = CreateWindowEx(WS_EX_CLIENTEDGE, "SysListView32", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | LVS_REPORT , 40, 40, 200, 200, hwnd, (HMENU)IDC_MAIN_HLIST, GetModuleHandle(NULL), 0);
    2.  
    3.         int lWidth;
    4.         lWidth = 1440;
    5.         Lv_AddColumn(hwnd,"jason",lWidth,IDC_MAIN_HLIST);
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  11. #11

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    can someone tell me how to add a column and test to the subitems
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  12. #12
    Hyperactive Member made_of_asp's Avatar
    Join Date
    Jul 2001
    Location
    123 Fake Street
    Posts
    394
    void Lv_AddColumn(HWND hWnd, LPSTR lpText, UINT uWidth, UINT uID)
    {
    //variable
    LVCOLUMN lvc;

    //create item
    lvc.mask = LVCF_TEXT | LVCF_WIDTH;
    lvc.pszText = lpText;
    lvc.cx = uWidth;

    //insert column
    ListView_InsertColumn(hWnd, uID, &lvc);
    }


    HWND = Handle to list view
    LPSTR = Text
    UINT uWidth = Width
    uID = ID of a column. Each column is increased in ID starting with 1. In your case just put one.
    VS.NET 2003

    Need to email me?

  13. #13

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    doh , thanks alot
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  14. #14

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    I got this really wierd problem. I got it the first time and it still
    works on that program but i follow what i did and try to make it again and no good. here are the basic lines i add

    VB Code:
    1. #include <windows.h>
    2. #include <commctrl.h>
    3. HWND hList;
    4.  
    5. hList = CreateWindowEx(WS_EX_CLIENTEDGE, "SysListView32", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | LVS_REPORT, 0, 0, 200,200, hwnd, NULL, GetModuleHandle(NULL), 0);
    6.  
    7. Lv_AddColumn(hList,"Jason",90,1);
    8. Lv_AddColumn(hList,"Lpz",90,2);
    9. //thats to add the listview
    10.  
    11.  
    12.  
    13. void Lv_AddColumn(HWND hWnd, LPSTR lpText, UINT uWidth, UINT uID)
    14. {
    15.     //variable
    16.     LVCOLUMN lvc;
    17.  
    18.     //create item
    19.     lvc.mask = LVCF_TEXT | LVCF_WIDTH;
    20.     lvc.pszText = lpText;
    21.     lvc.cx = uWidth;
    22.  
    23.     //insert column
    24.     ListView_InsertColumn(hWnd, uID, &lvc);
    25. }
    26. //to add column
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  15. #15

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    heres the full source
    Attached Files Attached Files
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  16. #16

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    As i thought it was my stupid PC its sick i had to restart it works great now lol thanks alot again
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width