Assuming this is the defaut Windows API listbox..
Step 1: Find a handle to the window containing the list box. [link]
Step 2: Allocate enough space to hold the strings. eg.[INDENT]
int count = (int) SendMessage( listbox, LB_GETCOUNT, 0, 0 );
std::string *items = new string[count];
[/INDENT]Step 3: Retrieve those values. eg.[INDENT]
for (int i = 0; i < count; ++i) {
int itemLength = SendMessage( listbox, LB_GETTEXTLEN, i, 0 );
char *temp = new char[itemLength];
SendMessage( listbox, LB_GETTEXT, i, (LPARAM)&temp );
items[i] = temp;
delete[] temp;
}
[/INDENT]I haven't tested this code, but it should work if you apply it right. Hope this helps.
William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
thanks William, for your response.
Can you pls do me a favor to write a tiny app to read those values. With an interface like, specifying the window handle by some drag/drop thing and then read the list box values, etc.
I am very new to C++ programming and got this as a task :-s
Look forward to your response...
That's too much to ask for.
If you're very new to programming, you shouldn't have been set a task like this. I wontdo it for you, but what I will do is lead you in the right direction. Start by familiarizing yourself with basic C++, then follow this Win32 API tutorial [link]
There's plenty in there to get you started, after all, that's exactly how I learnt it.
Remember, we aren't here to write code for you.
William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129
What? Once again, not helping.
Also, I said Assuming this is the defaut Windows API listbox.
William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 129