- This topic has 0 replies, 1 voice, and was last updated 9 years ago by Sub.
Viewing 1 post (of 1 total)
-
AuthorPosts
-
June 30, 2015 at 11:08 am #186430SubMember
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
-
AuthorPosts
Related
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.