listview in windows api

This is a discussion on listview in windows api within the Windows Programming forums, part of the Platform Specific Boards category; I have a list view and I'm trying to get all of the text out of it. This is my ...

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    15

    Question listview in windows api

    I have a list view and I'm trying to get all of the text out of it. This is my code so far:

    Code:
    for(i= 0; i < NumOfItems; i++)
    {
    char *text = new char[256];
    char *text2 = new char[256];
    
    ListView_GetItemText(hWndListView, 0, 0, text, 256);
    ListView_GetItemText(hWndListView, 0, 1, text2, 256);
    MessageBox(hWnd, text, "", MB_OK | MB_ICONINFORMATION);
    
    delete [] text;
    delete [] text2;
    }
    But I don't know how to move to the next item, so It keeps doing the first item over and over again. Could someone please help me I've been trying for a while. I'm using c++.

  2. #2
    Registered User
    Join Date
    Jan 2006
    Location
    Latvia
    Posts
    102
    Code:
    for(i= 0; i < NumOfItems; i++)
    {
    char *text = new char[256];
    char *text2 = new char[256];
    
    ListView_GetItemText(hWndListView, i, 0, text, 256);
    ListView_GetItemText(hWndListView, i, 1, text2, 256);
    MessageBox(hWnd, text, "", MB_OK | MB_ICONINFORMATION);
    
    delete [] text;
    delete [] text2;
    }

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    15
    Thanks Overlord.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Use windows API functions in a GTK+ program?
    By Jake.c in forum Windows Programming
    Replies: 19
    Last Post: 01-23-2009, 06:40 AM
  2. What does this do (Windows API)?
    By EVOEx in forum Windows Programming
    Replies: 4
    Last Post: 12-19-2008, 10:48 AM
  3. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  4. Windows messenger API
    By GanglyLamb in forum Windows Programming
    Replies: 0
    Last Post: 07-10-2005, 03:52 AM
  5. Future of Windows API programming ?
    By Dev in forum Windows Programming
    Replies: 7
    Last Post: 04-23-2003, 12:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21