c++ - Show dialog form not in modal mode -
i have dialog form. call application use code:
bool cpointmfc2app::initinstance() { cwinapp::initinstance(); dialog dlg1; dlg1.txt= "notificationtext"; int r= dlg.domodal(); return r; }
and don't wont have modal mode - let program go without waiting user input. how make dlg1 show in non modal mode?
dialog form:
#include "stdafx.h" #include "pointmfc2.h" #include "dialog.h" #include "afxdialogex.h" // dialog dialog implement_dynamic(dialog, cdialogex) dialog::dialog(cwnd* pparent /*=null*/) : cdialogex(dialog::idd, pparent) { } dialog::~dialog() { } void dialog::dodataexchange(cdataexchange* pdx) { cdialogex::dodataexchange(pdx); } begin_message_map(dialog, cdialogex) on_bn_clicked(idok, &dialog::onbnclickedok) end_message_map() // dialog message handlers bool dialog::oninitdialog() { cdialogex::oninitdialog(); setwindowtext(txt); return true; } void dialog::onbnclickedok() { // todo: add control notification handler code here cdialogex::onok(); }
to create nonmodal dialog have call dialog's create function. in constructor of dialog class. must return true initinstance keep program running.
m_pmainwnd = new dialog(); return true; // run mfc message pump
Comments
Post a Comment