error! repeatedly calling the same MFC dialog box in vc++
-
i am doing project on vc++ MFC DIALOG, where in i will be repeatedly calling the same dialog box morethan 100 times, but the problem is, that the dialog box is getting crashed(terminating or ending) after some 50 times.. what can be the problem?
-
i am doing project on vc++ MFC DIALOG, where in i will be repeatedly calling the same dialog box morethan 100 times, but the problem is, that the dialog box is getting crashed(terminating or ending) after some 50 times.. what can be the problem?
jklhjk wrote: what can be the problem? Probably that you have a bug in your program. As you don't describe anything about what the dialog does, it's difficult to be more specific :-) Have you tried running it in debug mode, you ought to get some more info on the reason this way?
-
jklhjk wrote: what can be the problem? Probably that you have a bug in your program. As you don't describe anything about what the dialog does, it's difficult to be more specific :-) Have you tried running it in debug mode, you ought to get some more info on the reason this way?
There is no bug in program,the same program i can run it in (c language) cmd prompt.. i have check it out by creating new dialog box ("hello")having only "OK" Buttton in it. void CHelloDlg::OnOK() { // TODO: Add extra validation here CDialog::EndDialog(IDOK); CHelloDlg cmd(this); cmd.DoModal(); } after running it . keep pressing the "ok" button continously, the dialog box crashes or ends after 50 times..
-
There is no bug in program,the same program i can run it in (c language) cmd prompt.. i have check it out by creating new dialog box ("hello")having only "OK" Buttton in it. void CHelloDlg::OnOK() { // TODO: Add extra validation here CDialog::EndDialog(IDOK); CHelloDlg cmd(this); cmd.DoModal(); } after running it . keep pressing the "ok" button continously, the dialog box crashes or ends after 50 times..
Are you trying to do some silly version of the obnoxious JavaScript-script popping up a messagebox forever ? Anyway, your problem might not so much be the number of times you display a dialog, but rather the amount of dialogs displayed (and parented) at the same time. But the idea of popping up a new dialog - of the same kind - in response to a press on the OK-button - is in the best case silly, in the worst downright malicious. As it is so easy to break out of the loop, by pressing Ctrl+Alt+Del, I'll suggest what you should do anyway: 1. Remove the code in the
OnOK
-handler, except for the call to the base class implementation. 2. Change the code originally creating the dialog to:while( true ) {
CHelloDlg cmd;
cmd.DoModal();
}3. Get a new hobby.