Paltalk 9.x Handles Class Vb.net

Hey

It’s just my old method https://www.imfiles.com/twiza-roomscontrols-handles-9-29-49-5-source/ put in a class

It’s not really conventional lol but it still works.

 

Public Class PtkRoom

Private Delegate Function EnumWin(ByVal HwD As Integer, ByRef lparam As Integer) As Int32

Private Declare Function EnumWindows Lib "user32.dll" Alias "EnumWindows" (ByVal FuncCall As EnumWin, ByRef lParam As Integer) As Boolean
Private Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Integer, ByVal FuncCall As EnumWin, ByRef lParam As Integer) As Boolean
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal HwnD As Integer, ByVal lpClassName As String, ByVal nMaxCount As Integer) As Integer

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal HwnD As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal HwnD As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer

Private Const WM_GETTEXT = &HD
Private Const WM_GETTEXTLENGTH = &HE

Private _RoomName As String
Private _RoomHwd As Integer
Private _listHWD As Integer
Private _roomCTL As Integer
Private _sendCTL As Integer
Private Shared _Rooms As New List(Of Integer)

Sub New(ByVal RoomHwd As Integer)

_RoomHwd = RoomHwd
_RoomName = GetText(RoomHwd)
EnumChildWindows(RoomHwd, New EnumWin(AddressOf FindHwndCTL), 0)

End Sub

Public Shared Function hGetRooms() As Integer()

EnumWindows(New EnumWin(AddressOf FindRooms), 0)
Return _Rooms.ToArray

End Function

Public ReadOnly Property hRoomWindow As Integer
Get
Return _RoomHwd
End Get
End Property

Public ReadOnly Property hUsersListCTL As Integer
Get
Return _listHWD
End Get
End Property

Public ReadOnly Property hRoomTextCTL As Integer
Get
Return _roomCTL
End Get
End Property

Public ReadOnly Property hSendTextCTL As Integer
Get
Return _sendCTL
End Get
End Property
Public ReadOnly Property RoomName As String
Get
Return _RoomName
End Get
End Property

Private Shared Function FindRooms(ByVal HwD As Integer, ByRef lparam As Integer) As Int32

Dim sClass As String = Space(255)
Dim nC As Integer = GetClassName(HwD, sClass, 255)
Dim WinTxt As String

sClass = sClass.Substring(0, nC)

If sClass = "DlgGroupChat Window Class" Then
WinTxt = GetText(HwD)
If WinTxt.Contains(" Voice Room") Then
_Rooms.Add(HwD)
End If
End If

Return 1
End Function

Private Function FindHwndCTL(ByVal HwD As Integer, ByRef lparam As Integer) As Int32

Dim sClass As String = Space(255)
Dim nC As Integer = GetClassName(HwD, sClass, 255)
Static i As UShort

sClass = sClass.Substring(0, nC)

If sClass = "SysListView32" Then _listHWD = HwD
If sClass = "RichEdit20A" Then
i += 1
If i = 3 Then _sendCTL = HwD
If i = 4 Then _roomCTL = HwD : i = 0 : Return 0 : Exit Function
End If

Return 1
End Function

Private Shared Function GetText(ByVal Hwnd As Integer) As String

Dim MyStr As String = Space(SendMessage(Hwnd, WM_GETTEXTLENGTH, 0, 0) + 1)
SendMessageByString(Hwnd, WM_GETTEXT, Len(MyStr), MyStr)
Return MyStr.Replace(Chr(0), "")

End Function

End Class

 

Example of use in form named “form1” with a TextBox named “TextBox1”

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

For Each i As Integer In PtkRoom.hGetRooms
Dim Room As New PtkRoom(i)
With Room
TextBox1.Text &= .RoomName & vbCrLf & "Window Handle: " & .hRoomWindow.ToString & vbCrLf & _
"Users List (SysListView32) Handle: " & .hUsersListCTL.ToString & vbCrLf & _
"Room Text (RichEdit20A) Handle: " & .hRoomTextCTL.ToString & vbCrLf & _
"Send Text (RichEdit20A) Handle: " & .hSendTextCTL.ToString & vbCrLf & vbCrLf
End With
Next
End Sub

 

I’m sorry I got this bad habit of sources with no comments 😳


Message for people who don’t understand what’s going on this class
You should use Winspector Spy or Spy++ and some Google, That’s the way I did 😉

One thought on “Paltalk 9.x Handles Class Vb.net

Leave a Reply

You must Register or Login to comment on Paltalk 9.x Handles Class Vb.net