Difficult? LB_GETTEXT is unreadable.
I'm using LB_GETTEXT to retrieve text from a listbox in another application, however the results are not exactly what I could have hoped for. I'm pretty sure my code here is correct, however I remember reading somewhere that I have to use ReadProcessMemory to retrieve the text, but I'm not sure. Any ideas?
Code:
Dim lCount As Long, lIndex As Long
Dim sItem As String, lLen As Long
Dim sList As String
lCount = SendMessage(hwnd, LB_GETCOUNT, 0&, ByVal 0&)
For lIndex = 0 To lCount - 1
lLen = SendMessage(hwnd, LB_GETTEXTLEN, lIndex, ByVal 0&)
sItem = Space(lLen)
Call SendMessage(hwnd, LB_GETTEXT, lIndex, ByVal sItem)
sList = sList & vbCrLf & sItem
Next