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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hopeful

Status
Not open for further replies.

jimjake

Technical User
Oct 30, 2004
25
US
I recently bought a book “ Visual C++ 6 Teach yourself in 24 hours.
I have a basic understanding of C++, but I wanted to learn Windows applications.
I am having problems with the SDI Applications. I have done the project listed in the book at least 50 times and it always ends the same way.
1. I use the MFC AppWizard to create a project, single document
2. I create the Dialog box .
3. I Customize it.
4. I add a simple static control.
5. I create a class for it.
6. I add a message handler
7. I update the code in ChelloDlg::OnInitDialog
8. I add a menu choice for the Dialog.
9. I add a message handling function
10. I update the CmainFrame::OnFileHello with the supplied code.
11. I build the exec, it compiles 0 errors 0 warnings
12. I execute the program, and all I get is a single window, there is no dialog box there.
13. Can you help? ……. jim
 
JimJake,

Have you created a Single Document MFC app or a Dialog Based app?

If you have created a Single Document MFC app then you need to create an instance of your dialog class and then show the dialog.

Example:

CMyDialog myDlg;
myDlg.DoModal();

This will show the dialog. You can put this in a menu handler.



 
Just adding a dialog to your project doesn't do anything. You have to tell it when to create the dialog, as cdraycott said. If you want it to do this when the application is first run, declare the dialog and call DoModal() in the view's OnInitialUpdate method (which you must overload).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top