July 21, 2012 at 2:03 am
#186854
Administrator
Yep I tried that method but is not returning the rooms title no more for me 🙂
Check the code
Paltalk MultiVB
and this code was posted in
'=========================== 'Find And Select Paltalk Room '=========================== Private Delegate Function EnumWindowsCallback(ByVal hWnd As Integer, ByVal lParam As Integer) As Boolean Private Declare Function EnumWindows Lib "user32.dll" Alias "EnumWindows" (ByVal callback As EnumWindowsCallback, ByVal lParam As Integer) As Integer Private Declare Sub GetWindowText Lib "user32.dll" Alias "GetWindowTextA" (ByVal hWnd As Integer, ByVal lpString As StringBuilder, ByVal nMaxCount As Integer) Private Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameA" (ByVal hwnd As Integer, ByVal lpClassName As StringBuilder, ByVal cch As Integer) As Integer Const StringBufferLength As Integer = 255 Private ClassName As String = String.Empty '******************** '** ** '** Public Methods ** '** ** '******************** 'Method to return selected Paltalk Room Public ReadOnly Property RoomName() As String Get ' Return the text of the combobox Return cbxRoomName.Text End Get End Property '======================================================================== Private Sub FindPalRooms() ' Enum all top windows EnumWindows(New EnumWindowsCallback(AddressOf FindChatRoomHandle), 0) End Sub '======================================================================== Private Sub RoomRefresh() Try ' Clear the combobox list cbxRoomName.Items.Clear() ' Add all rooms to combobox list FindPalRooms() ' check if combobox text is empty If cbxRoomName.Text = String.Empty Then ' if combobox text is empty, fill it wit first room on the list cbxRoomName.Text = cbxRoomName.Items.Item(0).ToString Else ' if combobox text is not empty, make sure it is on the list If cbxRoomName.FindStringExact(cbxRoomName.Text) = -1 Then ' if combobox text is not on the list Try ' set combobox text to first room on the list cbxRoomName.Text = cbxRoomName.Items.Item(0).ToString Catch ' if no rooms are in the list, set combobox text to nothing cbxRoomName.Text = "" End Try End If End If Catch ' if room refresh failes, set combobox list & text to nothing cbxRoomName.Items.Clear() cbxRoomName.Text = "" End Try End Sub '======================================================================= Private Function FindChatRoomHandle(ByVal hWnd As Integer, ByVal lParam As Integer) As Boolean Dim ChatWindowText As New StringBuilder(StringBufferLength) Dim ChatClassName As New StringBuilder(StringBufferLength) ' Get the Class Name GetClassName(hWnd, ChatClassName, StringBufferLength) ' Check if it is a Paltalk roomng If ChatClassName.ToString = ClassName Then ' If a Paltalk room, get room name (window caption) GetWindowText(hWnd, ChatWindowText, StringBufferLength) ' Add a new Room name to the combobox list For Each sroomname As String In ListBox2.Items If ChatWindowText.ToString = sroomname Then cbxRoomName.Items.Add(ChatWindowText.ToString) End If Next End If ' Continue to next window Return True End Function Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click FindPalRooms() RoomRefresh() End Sub Private Sub cbxRoomName_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxRoomName.SelectedIndexChanged End Sub
but when I call it with RoomRefresh()
sht dont work 🙄