visual c++ - Not able to print AfxMessagBox() After doModal() method -
visual c++ - Not able to print AfxMessagBox() After doModal() method -
bool cmsgboxapp::initinstance() { initcommoncontrolsex initctrls; initctrls.dwsize = sizeof(initctrls); initctrls.dwicc = icc_win95_classes; initcommoncontrolsex(&initctrls); cwinapp::initinstance(); afxenablecontrolcontainer(); setregistrykey(_t("local appwizard-generated applications")); cmsgboxdlg dlg; m_pmainwnd = &dlg; int_ptr nresponse = dlg.domodal(); if (nresponse == idok) { afxmessagebox(l"here",0,0);//this messagebox not getting displayed } else if (nresponse == idcancel) { } homecoming false; }
in above code afxmessagebox()
not getting displayed. why problem coming?
first created modal dialogbox , after homecoming tried provide message box not displayed
i'm not sure may afxmessagebox
not provide own message pump cdialog::domodal()
does. assume afxmessagebox
calls win32 messagebox()
function, require message pump dispatch painting / click messages etc.
edit: windows programs work passing messages around. windows programs have message "pump" process incoming messages things painting screen, , reacting mouse clicks etc. had code message pump yourself.
mfc came along , provided message pump you. there 1 in cwinapp::run()
normal sdi/mdi applications, , 1 in cdialog::domodal()
dialog based applications (and modal dialogs in general).
the code have posted dialog based mfc application. "application" dialog. 1 time have returned dialog, there no message pump , application pretty much dead. should doing little after this, perchance cleanup. not displaying more information.
if want display more info on close, override onclose()
in application dialog, , phone call afxmessagebox()
there.
visual-c++ mfc
Comments
Post a Comment