Add SendText functionality to projectNow that we can easily select which Paltalk room we want to work with, lets add some functionality to our project. Lets send text to the selected Paltalk room! To do this, lets add a Text box to the form that we can type into and a button that will send our message to the room.
Switch back to the design view, open the toolbox (if it is not expanded), select “TextBox” and drag it onto the form. Then do the same thing with “Button”.

- figure 12
Double click on the button to add code to the button click event. To make the button click send the text from the textbox to the selected Paltalk room, we must find the handle of the Richedit control in the Paltalk client. To do this, there are many different ways that can be taken. The way I will show here is:
Find the handle of the splitter window that contains the richedit control
Use splitter window handle to find the richedit control
Step 1:
Using SubFormHndByClassNameWithMWClassWithPartialMWCaption of the mdlGetHnd, get a handle for the splitter window.
Step 2:
Using SubFormHndByClassNameWithMWHnd of the mdlGetHnd, get a handle for the richedit control.
Each of the steps above will return an integer, so we must first create an integer object to receive the data.
Dim iHnd As Integer
Then we need to call our function to get the splitter window handle. mdlGetHnd.SubFormHndByClassNameWithMWClassWithPartialMWCaption requires 4 pieces of information to find the correct handle.
1.) Class name of the parent window (mdlPalInfo.ChatRoomClass)
2.) Caption text of the parent window (our selected room name)
3.) Class name of the subwindow (mdlPalInfo.SplitterClass)
4.) Index from the parent window (mdlPalInfo.SplitterIndex)
So we end up with the following:
iHnd = mdlGetHnd.SubFormHndByClassNameWithMWClassWithPartialMWCaption(mdlPalInfo.ChatRoomClass, Me.CtrlRoomSelector1.RoomName, mdlPalInfo.SplitterClass, mdlPalInfo.SplitterIndex)
We are now ready to Find the richedit handle. mdlGetHnd.SubFormHndByClassNameWithMWHnd requires 3 pieces of information to find the correct handle.
1.) Handle of the parent window (iHnd from previous step)
2.) Class name of the subwindow (mdlPalInfo.ChatTextClass)
3.) Index from the parent window (mdlPalInfo.SendTextIndex)
So we end up with the following:
iHnd = mdlGetHnd.SubFormHndByClassNameWithMWHnd(iHnd, mdlPalInfo.ChatTextClass, mdlPalInfo.SendTextIndex)
Now that we have the handle to the richedit box, we can use it to send the text to the Paltalk client. We will use the “SendMessageByString” API to send the text. This API is configured in the mdlGetHnd module so we do not need to do anything more to use it (except call it correctly). This API also returns an integer, so let us configure an integer object to receive the return form “SendMessageByString”.
Dim iResult As Integer
We need to now send our text followed by the enter key press and release. The “SendMessageByString requires 4 pieces of information to send a message.
1.) Handle of control to send message to (iHnd from previous step)
2.) Type of message as integer (constants we will define in a moment)
3.) wParam as an integer
4.) lParam as a string (our text)
For sending text, the type of message is WM_SETTEXT
For sending key press, the type of message is WM_KEYDOWN
For sending key release, the type of message is WM_KEYUP
The wParam for sending text is 0
The wParam for sending enter key press is VK_Return
The wParam for sending enter key release is VK_Return
We must define the above constants as:
Const WM_SETTEXT As Integer = &HC
Const WM_KEYDOWN As Integer = &H100
Const WM_KEYUP As Integer = &H101
Const VK_Return As Integer = &HD
After the constants are set up, we can make our SendTextByString calls. Send the text:
iResult = SendMessageByString(iHnd, WM_SETTEXT, 0, Me.TextBox1.Text)
Send the enter key press:
iResult = SendMessageByString(iHnd, WM_KEYDOWN, VK_Return, 0)
Send the enter key release:
iResult = SendMessageByString(iHnd, WM_KEYUP, VK_Return, 0)

- figure 13
Run the project in debug mode to test it (use green arrow on toolbar). Select a room, type into the text box, and click on button 1.

- figure 14
- Figure14.PNG (5.64 KiB) Viewed 3325 times
If you followed the instructions, you will have your text post into the selected room.

- figure 15
- Figure15.PNG (9.48 KiB) Viewed 3327 times
This has been a basic overview of how to send text to a Paltalk room. While it does work, there are some inherent limitations on what this code can do. To add more functionality to sending text, search the Locohacker.net forums for more help.
You can now play with some of the other things included in the modules that are part of the project.
I did not use the mdlSysListView, but you can use it to find and/or highlight a nic in the room nic list.
With the mdlRegAccess, you can save your program settings to the registry or read any registry value you need.
The mdlGetHnd has other methods to find handles, but the 2 I used in this example are the ones that will be most often needed.
Edit: Added figures to post