Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a Dialog to report series of status messages?

Status
Not open for further replies.

rdg2cig

Programmer
Sep 16, 1999
22
US
I would like to display the path of execution my MFC application is taking through a decision tree that performs calculations. Each time a branch of the decision tree is encountered, I would like to append another message (a simple CString) to a dialog box that would appear upon initial entry into the calculation portion of the application. In this way I could track the execution path through the decision tree. How can I create a dialog that will display a series of messages (preferably by appending the new messages below the existing messages) that are not all known at the time the dialog is displayed on the screen?
 
There are many scenarios:
1. Create a new thread, (not a worker thread, but one that has a message loop by deriving a new class from CWinThread (MSDN has samples on this) - then you use RegisterWindowMessage to register a custom message. You then add a handler (by hand not with Class Wizard) for your custom message.

Then is simple - your dialog will stay popped all the time and whenever you need to log the execution you add a SendMessage in your code with a message for youir dialog. In the dialog I suppose you will add a new item to list box in the custom event handler function.

2. Create a separate application and use an aprox the same scenario. you have to find a way to pass the HWND to the SendMessage Function. This method has the advantage of being PROGRAM INDEPENDENT, you could use it in another programs too.

I am sure that there can be other ways but this is what came to my mind first.

Hope this helps,
s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top