Re: get text from listbox
- From: "RB Smissaert" <bartsmissaert@xxxxxxxxxxxxxxxx>
- Date: Thu, 1 Dec 2005 18:30:50 -0000
Yes, still the same garbled output. Tried your code, but it gives me the same. Had a go with AccessibleObjectFromPoint and that is an interesting API, but gave me question marks as output. So no progress yet. I suppose it just isn't a standard Windows listbox.
RBS
"Karl E. Peterson" <karl@xxxxxxxx> wrote in message news:%23aPTJGq9FHA.2120@xxxxxxxxxxxxxxxxxxxxxxx
RB Smissaert wrote:Trying to get the text of items in a listbox of an external application.
Hard to tell from the thread if you're still having issues with this. But I
wrote this long ago, and it works great for standard listboxes:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LB_GETTEXT = &H189 Private Const LB_GETTEXTLEN = &H18A Private Const LB_GETCOUNT = &H18B Private Const LB_ERR = (-1)
' Within some routine, assuming you have a valid hWnd... Dim nCount As Long, i As Long Dim TxtLen As Long Dim Buffer As String
nCount = SendMessage(hWnd, LB_GETCOUNT, 0&, ByVal 0&) If nCount <> LB_ERR Then For i = 0 To nCount - 1 TxtLen = SendMessage(hWnd, LB_GETTEXTLEN, i, ByVal 0&) If Len(Buffer) < (TxtLen + 1) Then Buffer = Space$(TxtLen + 1) End If If SendMessage(hWnd, LB_GETTEXT, i, ByVal Buffer) <> LB_ERR Then Debug.Print Left$(Buffer, TxtLen) End If Next i End If
Later... Karl -- Working without a .NET? http://classicvb.org/
.
- Follow-Ups:
- Re: get text from listbox
- From: Thorsten Albers
- Re: get text from listbox
- From: Karl E. Peterson
- Re: get text from listbox
- From: Karl E. Peterson
- Re: get text from listbox
- References:
- get text from listbox
- From: RB Smissaert
- Re: get text from listbox
- From: Karl E. Peterson
- get text from listbox
- Prev by Date: Re: get text from listbox
- Next by Date: Re: get text from listbox
- Previous by thread: Re: get text from listbox
- Next by thread: Re: get text from listbox
- Index(es):
Relevant Pages
|
Loading