GetList32 - Get 32 Bit Listbox Text with VB3
This code will get text from listbox's on 32 bit software using VB3. I've been trying to find a way to do this for a long time now. It was not possible in the past because getting listbox text using vb3 for 32 bit programs, required User32 and Kernel32 which vb3 did not allow. So I looked and looked for a way to do it and I found it. A DLL called "Call32.dll" allowed me to use 32 bit dll's. So here it is. If you like the code, please vote for me. Also, if someone can lead me on the right path for creating a .HLP file in vb3, I will create a help file on using Call32.dll. Jeffrey C. Tatum - http://www.oaknetwork.com/vb
KI-Zusammenfassung: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Function AOLGetList32 (tree, Index As Integer, Buffer As String)
'Tree = The listbox
'Index = Listbox Index
'Buffer = output
'Example:
' a = GetList32(SomeList&, 0, Buffer$)
' MsgBox Buffer$
'Buffer is the text that was taken from the 32 bit
'listbox.
On Error Resume Next
DoEvents: idGetWindowThreadProcessId = Declare32("GetWindowThreadProcessId", "user32", "ip")
DoEvents: idOpenProcess = Declare32("OpenProcess", "kernel32", "ppi")
DoEvents: idReadProcessMemory = Declare32("ReadProcessMemory", "kernel32", "iipip")
DoEvents: idRtlMoveMemory = Declare32("RtlMoveMemory", "kernel32", "ppi")
DoEvents: idCloseHandle = Declare32("CloseHandle", "kernel32", "p")
Dim AOLProcess As Long
Dim ListItemHold As Long
Dim PerSon As String
Dim ListPersonHold As Long
Dim ReadBytes As Long
AOLThread = GetWindowThreadProcessId(tree, AOLProcess, idGetWindowThreadProcessId)
AOLProcessThread = OpenProcess(PROCESS_VM_READ Or STANDARD_RIGHTS_REQUIRED, False, AOLProcess, idOpenProcess)
If AOLProcessThread Then
PerSon$ = String$(4, 0&)
ListItemHold = SendMessage(tree, LB_GETITEMDATA, ByVal CLng(Index), ByVal 0&)
ListItemHold = ListItemHold + 24
Call ReadProcessMemory(AOLProcessThread, ListItemHold, PerSon$, 4, ReadBytes, idReadProcessMemory)
Call RtlMoveMemory(ListPersonHold, ByVal PerSon$, 4, idRtlMoveMemory)
ListPersonHold = ListPersonHold + 6
PerSon$ = String$(17, 0&)
Call ReadProcessMemory(AOLProcessThread, ListPersonHold, PerSon$, Len(PerSon$), ReadBytes, idReadProcessMemory)
PerSon$ = Left$(PerSon$, InStr(PerSon$, Chr(0)) - 1)
Call CloseHandle(AOLProcessThread, idCloseHandle)
End If
Buffer$ = PerSon$
End Function