Archived

This topic is now archived and is closed to further replies.

Probably a simple Windows question

This topic is 5576 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have got my window up and running and it works my only query is how can you tell if the message handler is doing it''s job like it should? My guess was, if it was not working then you could not load up other tasks such as wordpad, exit and then minimise and maximise the actual window you created. Is this correct or am I way off and if so how can you tell? Thanks, Pk

Share this post


Link to post
Share on other sites
There are multiple ways of examing your message handler, or tracing your message pipeline. Firstly, if you are using Visual Studio you can use the utility ''spy++''. Spy++ is very useful in seeing what''s going on in your program. Secondly, you can use standalone message spying programs that other people have created and have made available over the Internet. Thirdly, if you need more exact message logging you can write code for yourself that does it. The third option can range from simple logging to very complex message logging. Which way you choose depends on your needs and your personal preferrences.

The key to really understaning Windows programming is by fully grasping the concept of windows messages. One thing to keep in mind is that a message handler could be working exactly how it was designed to while at the same time appear that it''s not working the way you intended.

Here''s an example of something working how it was designed to but not how I intended it to work. Two days ago I added a tab control and a tree view control to a program that I am working on. My intent was to keep shown selections synchronized between the two controls. It worked just fine, although I was able to find out using spy++ that a message loop between the two controls was occuring. When communication between multiple windows/controls it would be prudent to make sure an undesired message loop is not happening. I suspected three notification messages as causing the message loop. Eventhough I thought I understood the messages that were being sent I decided to reread the documentation on them. For one of the messages, the docs cleary stated that a specific message wouldn''t be generated after sending this particular notification message. For the second message the docs left some ambiguity because it didn''t mention one way or another about additional messages. For the third message the docs did say that it would generate another message. It should be obvious as to which message was causing the loop. I removed the notification that was causing the problem and the loop went away without affecting how the two controls operated.

Hope some of this helps. If you have any specific questions, don''t hesitate to ask.

Share this post


Link to post
Share on other sites