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

for(i= 0; i < NumOfItems; i++)
            {
            char *text = new char[256];
              char *text2 = new char[256];
                                     // mask
              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 I keeps doing the first item over and over again. Could someone please help me I've been trying for a while.

Recommended Answers

All 2 Replies

First, don't allocate the buffers like that. Its just toooo much! If you want to use dynamic allocation then allocate them before the loop and delete them after the loop terminates.

>>But I don't know how to move to the next item
Increment the second parameter ??

Thanks it works now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.