- This topic has 7 replies, 6 voices, and was last updated 12 years ago by String.
-
AuthorPosts
-
July 12, 2010 at 11:18 pm #187206AdminAdministrator
Problem:
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.
Solution:
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
Typein,43
SendButton,52
ChatRoomDisplay,49Completeness:
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
Negatives:
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.
Enclosure:
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]July 13, 2010 at 3:01 am #187213StringMemberCongratulations. You’ve invented the window spy.
July 13, 2010 at 3:05 am #187212DepartureMemberNice work dave, But another method would be to check out Autopilots examples, which he uses emulates all controls on the main form to get the handles of the room text, room send button, and the room input text. This removes the problem of doing any updates to your apps because it will always find the correct control. Good work you have done and I see you have spent the time explaining your solution. My suggestion is if you want to eliminate the use of using “positions” in a text file, Pm autopilot for an explanation or check his source codes on this site.
July 13, 2010 at 4:44 am #187211AdminAdministrator@String wrote:
Congratulations. You’ve invented the window spy.
Nah, it isn’t a windows spy, and that’s the point. A spy will help you find instances of the controls. It doesn’t tell you how to write code to find them again in an application. And you still have to change the app. Also there is no way a spy could be used by the end user, even if they had the source code, whereas this method, although a little tricky, could be used by an end user as all they do is point out the controls by clicking on them in the paltalk window.
July 13, 2010 at 5:18 am #187210StringMember@ChicagoDavid52 wrote:
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.
Not unlike a window spy
@Departure wrote:
But another method would be to check out Autopilots examples, which he uses emulates all controls on the main form to get the handles of the room text, room send button, and the room input text. This removes the problem of doing any updates to your apps because it will always find the correct control.
July 13, 2010 at 5:57 pm #187209AhFoxMemberGood tips … all advices are great 🙂
July 13, 2010 at 7:24 pm #187208autopilotMemberEven though I am Enumerating the windows, I do use class names and index values. This does mean that from time to time the Pal update does “Break” my apps. My method was working strong from 8.5 through 9.8, but in 9.9, it finally broke. I had to change a class name to get it working again. But Pal also changed the nic list in 9.9 and so having a user modifiable class name and index value would not have helped.
But it is very nice to see that others are working on ways to overcome the issue of finding the subforms. Keep up the good work!
February 15, 2012 at 1:16 pm #187207MeggansFKMemberI searched before and found this answer in several threads and I did not have it set to NONE before it did not display anything. After setting it to NONE, only the message box and smilies appeared, the controls however not.
-
AuthorPosts
Related
- You must be logged in to reply to this topic.