
04-21-2003, 10:33 AM
|
 |
Keeper of foo
Retired Moderator * Guru *
|
|
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
|
|
|
Basically, once you have the Listbox hWnd, you use LB_GETCOUNT to get the number of lines in the listbox. Then you need the size of all of them, so in a For loop (For count = 0 to Number of Lines - 1) you add together the length of each line using LB_GETTEXTLEN. Allocate this much to a String var, then in another For loop you go through the Listbox line by line using LB_GETTEXT. In your SendMessage in this loop, your wParam should be the line number in the Listbox you're on (your for loop counter) and your lParam will be the position in the string variable where this line goes. Probably you want a vbCrLf between each one also. Just add it after every line you read.
This reads all lines in the listbox. If you just want a particular line, you don't need the For loops. You still have to find the length of the line you want, allocate memory for it, and pass that line number via SendMessage.
|
|