c++ - MFC create Modeless dialog that does not lose focus -
i want create dialog in mfc that, once shows up, can't lose focus. blocking user access main sdi window, while processing data. flow similar to:
- user triggers process
- application shows dialog
- application starts process function
i can't modal dialog, because domodal()
function doesn't return until dialog closes, never trigger step 3.
how can done?
edit
these functions notifying task start , task end:
void cmodguiapp::_notify_task_start() { _processing_dialog->domodal(); } void cmodguiapp::_notify_task_end() { _processing_dialog->enddialog(1); }
this code triggering task process:
void trigger_task(std::function<void()> f) { cmodguiapp::_notify_task_start(); f(); cmodguiapp::_notify_task_end(); }
try following approach:
call
_processing_dialog->domodal();
on process dialog class wherever appropriate:
afxgetapp()->getmainwnd()->sendmessage(wm_your_user_message)
on main window class message map, add
on_message(wm_your_user_message, yourusermessagehandlerfunction)
implement
yourusermessagehandlerfunction()
. have retaken handling @ main window.
Comments
Post a Comment