Checkboxes all friends "Invite to Room"

I’m trying to checkboxes all friends in “Invite to Room” by this code
but not work
I need help

Private Const LVM_FIRST As Long = &H1000
Private Const LVIS_STATEIMAGEMASK As Long = &HF000&
Private Const LVM_SETITEMSTATE As Long = LVM_FIRST + 43

Private Type LVITEM
mask As Long
iItem As Long
iSubItem As Long
State As Long
stateMask As Long
pszText As String
cchTextMax As Long
iImage As Long
lParam As Long
iIndent As Long
End Type
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 Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Sub ListView_SetItemState(ByVal hWndLV As Long, ByVal i As Long, _
ByVal nData As Long, ByVal mask As Long)
Dim LVI As LVITEM
LVI.stateMask = mask
LVI.State = nData
SendMessage hWndLV, LVM_SETITEMSTATE, i, LVI
End Sub

Sub ListView_SetCheckState(ByVal hWndLV As Long, ByVal i As Long, _
ByVal fCheck As Boolean)
ListView_SetItemState hWndLV, i, 4096 * (1 - fCheck), LVIS_STATEIMAGEMASK
End Sub

Private Sub command1_Click()
Static State As Boolean
State = Not State
'the -1 would normally be a zero based LV item number
' but -1 toggles them all
Dim x As Long, syslistview As Long
x = FindWindow("#32770", vbNullString)
syslistview = FindWindowEx(x, 0&, "syslistview32", vbNullString)

ListView_SetCheckState syslistview , -1, State
End Sub

 

One thought on “Checkboxes all friends "Invite to Room"

Leave a Reply

You must Register or Login to comment on Checkboxes all friends "Invite to Room"