confused MFC CREATING CLASS AND MESSASE HANDLE
-
im making a program that has a button on the dialog. When pressed, it pops up another dialog.It is a math calculator program. This specific button calculates square root. I need to have the thing go in a child window(modal dialog) because i have other formula buttons to add... So i go in the class wizard, create a dialog of the CDIALOG BASE ....then i try to add a message handel..... then on my main dialog, i add the code CDialog aboutDlg(IDD_ABOUTBOX); // Create and show the dialog box INT_PTR nRet = -1; nRet = aboutDlg.DoModal(); // Handle the return value from DoModal switch ( nRet ) { case -1: AfxMessageBox("Dialog box could not be created!"); break; case IDABORT: // Do something break; case ID_SOMETHING: MessageBox("hello", "bonjour(s)", MB_OK); break; case IDCANCEL: // Do something break; default: // Do something break; }; i know DOMODAL IS RESTRICTED in a few perimters but someone told me to create a class and make message handles...than override domodal with my code...nothing happens....message box does not appear ....i just lost though..nothing is working at all..please give me detials or a tutorial on how to create a class derived from CDIALOG than add message handles.
-
im making a program that has a button on the dialog. When pressed, it pops up another dialog.It is a math calculator program. This specific button calculates square root. I need to have the thing go in a child window(modal dialog) because i have other formula buttons to add... So i go in the class wizard, create a dialog of the CDIALOG BASE ....then i try to add a message handel..... then on my main dialog, i add the code CDialog aboutDlg(IDD_ABOUTBOX); // Create and show the dialog box INT_PTR nRet = -1; nRet = aboutDlg.DoModal(); // Handle the return value from DoModal switch ( nRet ) { case -1: AfxMessageBox("Dialog box could not be created!"); break; case IDABORT: // Do something break; case ID_SOMETHING: MessageBox("hello", "bonjour(s)", MB_OK); break; case IDCANCEL: // Do something break; default: // Do something break; }; i know DOMODAL IS RESTRICTED in a few perimters but someone told me to create a class and make message handles...than override domodal with my code...nothing happens....message box does not appear ....i just lost though..nothing is working at all..please give me detials or a tutorial on how to create a class derived from CDIALOG than add message handles.
in that case can you give code of your DOMODAL function? if you want a simple work around then you can store that square root value in some global or class variable and then use it in parent dialog. But if you want to go with domodal then share that code. Thanks.
-
im making a program that has a button on the dialog. When pressed, it pops up another dialog.It is a math calculator program. This specific button calculates square root. I need to have the thing go in a child window(modal dialog) because i have other formula buttons to add... So i go in the class wizard, create a dialog of the CDIALOG BASE ....then i try to add a message handel..... then on my main dialog, i add the code CDialog aboutDlg(IDD_ABOUTBOX); // Create and show the dialog box INT_PTR nRet = -1; nRet = aboutDlg.DoModal(); // Handle the return value from DoModal switch ( nRet ) { case -1: AfxMessageBox("Dialog box could not be created!"); break; case IDABORT: // Do something break; case ID_SOMETHING: MessageBox("hello", "bonjour(s)", MB_OK); break; case IDCANCEL: // Do something break; default: // Do something break; }; i know DOMODAL IS RESTRICTED in a few perimters but someone told me to create a class and make message handles...than override domodal with my code...nothing happens....message box does not appear ....i just lost though..nothing is working at all..please give me detials or a tutorial on how to create a class derived from CDIALOG than add message handles.
The code you've shown has little, if anything, to do with the question you've asked.
acce55 wrote:
please give me detials or a tutorial on how to create a class derived from CDIALOG...
If you have already designed the dialog template, open ClassWizard (Ctrl+W). It should prompt you for creating a class or selecting an existing class. Selecting the former should bring up a New Class dialog with the Base class and Dialog ID already filled in. The steps in VS200x are different. I do not have that version in front of me to provide details.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius