VB Code:
Const LVM_FIRST As Long = &H1000 Const LVIF_STATE As Long = &H8 Const LVIS_SELECTED As Long = &H2 Const LVIS_FOCUSED As Long = &H1 Const LVM_SETITEMSTATE As Long = (LVM_FIRST + 8) Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _ ByVal hwnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ ByRef lParam As Any) As Long Private Sub Command1_Click() With myLVitem .mask = LVIF_STATE .state = &HF .stateMask = LVIS_SELECTED Or LVIS_FOCUSED End With dmWriteProcessData lvItemPointer, VarPtr(myLVitem), Len(myLVitem) apiResult = SendMessage(lvWindow, LVM_SETITEMSTATE, 1, lvItemPointer) End Sub
You didn't add the LVM_FIRST declaration that I posted above. The above should work and highlight the first item. For the 2nd item you should use (I'm guessing) :
VB Code:
apiResult = SendMessage(lvWindow, LVM_SETITEMSTATE, 2, lvItemPointer)
For the 3rd item :
VB Code:
apiResult = SendMessage(lvWindow, LVM_SETITEMSTATE, 3, lvItemPointer)
And so on...




Reply With Quote