July 12, 2010 at 11:18 pm #14896imFilesAdministrator
When Paltalk comes out with a new version of the Paltalk client it can change the layout of the Paltalk window which may break some applications that read and write to the client. Users of such programs are out of luck until the code is updated. This is very frustrating when the program is never updated.
One solution to this is to keep the information on the location of the Paltalk controls needed to read and write outside of the application in a file. The application reads the file to set up the controls. If information on the location of the control needs to be updated then the user can change it or the person who wrote the application can update the context of the file.
The way I thought of storing the information on the control so that it can be searched for is to store its position when Windows does a traversal of the paltalk window using “EnumChildWindows” procedure. For example, if the “Send” button is the 15th child window during that traversal then save “15” for the Send button in the file. Then when your application starts up, do an EnumChildWindows traversal and use the 15th child window as the handle for the “Send button”.
Specifying the location of the important controls (Typein, Send, Chat room)
No matter what method you use to save information about the location of the control, the easiest way of specifying a control is by clicking on it. That’s what my demo program does. It prompts for each of three controls, the user clicks and holds for several seconds, and the result is printed in the Results window. When all 3 controls are specified in this manner then the user can save out the information in a file.
An example in vb.net 2008.
I enclosed an example project showing this. The project contains 2 modules. “Paltalk” is used to determine where the controls are in the window and to save out their locations in a file. “TestApp” is a very simple application that uses the information in the file to then write to and read from the Paltalk chat room.
This example was tested in Paltalk but the idea could be used elsewhere. I tried it in Yahoo chat room and it printed (it printed rich text which the yahoo room doesn’t deal with correctly) ok but it didn’t read correctly but perhaps I wasn’t reading the correct line in the Yahoo window.
See a demo of using this application on youtube as:
Sample output file:
This is the contents of the file that shows the Window class found and the positions of all 3 controls
WindowClass,DlgGroupChat Window Class
I’m only saving out the Typein control, the Send button, and the room text screen. That is enough to do basic stuff, such as greeters. There are other applications that use other parts of the Paltalk chat window. I don’t deal with their complexities here, such as the complexity of the list of people in the room itself and what to do if that format changes
This approach is very specific to the screen layout. If the screen layout differs between people, for example for different colored nics, then each type of layout will need a different windows information file.
A project in vb.net 2008 showing how one can create a file containing positions of the controls by clicking on them. It also shows a very simple application that reads and writes to the paltalk window given data on those controls.[attachment=0:2ojngyyn]PaltalkInterface.zip[/attachment:2ojngyyn]
- You must be logged in to reply to this topic.