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:

  1. user triggers process
  2. application shows dialog
  3. 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:

  1. call

    _processing_dialog->domodal();

  2. on process dialog class wherever appropriate:

    afxgetapp()->getmainwnd()->sendmessage(wm_your_user_message)

  3. on main window class message map, add

    on_message(wm_your_user_message, yourusermessagehandlerfunction)

  4. implement yourusermessagehandlerfunction(). have retaken handling @ main window.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -