Get All Name & Handle Paltalk

Private Delegate Function EnumWin(ByVal hWnd As IntPtr, ByVal lparam As IntPtr) As Integer
<dllimport("user32.dll")> _
Private Shared Function EnumWindows(ByVal FuncCall As EnumWin, ByVal lParam As IntPtr) As Integer
End Function
<dllimport("user32.dll")> _
Private Shared Function EnumChildWindows(ByVal hWndParent As IntPtr, ByVal FuncCall As EnumWin, ByVal lParam As IntPtr) As IntPtr
End Function
<dllimport("user32.dll")> _
Private Shared Function GetWindowText(ByVal hWnd As IntPtr, ByVal str As StringBuilder, ByVal nMaxCount As Integer) As Integer
End Function
<dllimport("user32.dll")> _
Private Shared Function GetClassName(ByVal hWnd As IntPtr, ByVal lpClassName As StringBuilder, ByVal nMaxCount As Integer) As Integer
End Function
Private RoomName As New List(Of String) ' List RoomName
Private RoomHwnd As New List(Of IntPtr) ' List RoomHandle
Private Sub refreshRooms()
RoomHwnd.Clear()
RoomName.Clear()
EnumWindows(New EnumWin(AddressOf dlgFind), IntPtr.Zero)
End Sub
Public Function GetRoomNames() As String()
Return roomName.ToArray()
End Function
Private Function dlgFind(ByVal hWnd As IntPtr, ByVal lparam As IntPtr) As Integer
Dim tmp As New StringBuilder(255)
GetClassName(hWnd, tmp, 255)
If tmp.ToString().Contains("DlgGroupChat Window Class") Then
tmp.EnsureCapacity(255)
GetWindowText(hWnd, tmp, 255)
RoomName.Add(tmp.ToString())
RoomHwnd.Add(hWnd)
End If
Return 1
End Function

using combobox or ….

Private Sub ComboBox1_DropDown(sender As Object, e As EventArgs) Handles ComboBox1.DropDown
ComboBox1.Items.Clear()
refreshRooms()
For Each Str As String In GetRoomNames()
ComboBox1.Items.Add(Str)
Next Str
End Sub

Leave a Reply

You must Register or Login to comment on Get All Name & Handle Paltalk