- This topic has 2 replies, 3 voices, and was last updated 17 years ago by Snoopy1968.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
October 15, 2007 at 9:51 pm #187714autopilotMember
This is a function that will highlight the item at a given index value in a SysListView. You pass to it the SysListview handle and the index of the the item to highlight. It uses the same const and API declarations as to read the selected text.
The SysListView indexing is zero based, so to highlight the third item, pass an iIndex value of 2.
Public Function HiLiteSLVItem(ByVal hwnd As Long, ByVal iIndex As Long)
Dim lProcID As Long
Dim hProc As Long
Dim lxprocLVITEM As Long
Dim LVITEM As LV_ITEM
Dim lItemPos As Long
GetWindowThreadProcessId hwnd, lProcID ' Get the process ID in which the ListView is running
If lProcID <> 0 Then
hProc = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, lProcID) ' makwe sure we have read write permissions in the process space
If hProc <> 0 Then
lxprocLVITEM = VirtualAllocEx(hProc, 0, LenB(LVITEM), MEM_RESERVE Or MEM_COMMIT, PAGE_READWRITE) ' Grab enough memory in the other procedure's space to hold our LV_ITEM
' Set up our local LV_ITEM to change the selected item
LVITEM.mask = LVIF_STATE
LVITEM.state = True
LVITEM.stateMask = LVIS_SELECTED
' Copy the local LV_ITEM into the space we reserved in the foreign process
WriteProcessMemory hProc, ByVal lxprocLVITEM, ByVal VarPtr(LVITEM), LenB(LVITEM), 0
' Now send the message, but pass the address of the copy of our LV_ITEM that now exists in the foreign process instead of our local versiony
lItemPos = iIndex& ' index of item to highlight
SendMessage hwnd, LVM_SETITEMSTATE, lItemPos, ByVal lxprocLVITEM
' Clean up
VirtualFreeEx hProc, ByVal lxprocLVITEM, LenB(LVITEM), MEM_RELEASE
CloseHandle hProc
End If
End If
End Function
October 16, 2007 at 2:56 pm #187716Snoopy1968MemberHey thats cool do you know how to read SystemTreeView?
November 12, 2007 at 5:12 pm #187715methodMembercould you upload a working vb6 that highligths and selects user name giving its position in the listview in paltalk 9.2 ? i couldn’t modify my old code which was for paltalk 8.2!! Looking forward for your reply.Thanks
-
AuthorPosts
Related
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.