QMessageBox in MFC application
-
Hi Experts,
I have a MFC MDI application, and somewhere I'd like to pop up a QMessageBox.
However, I find that the message box is not modal, I still can interact with "view" and "main frame" in MFC world.
Here're my codes, any suggestions? Thanks!@
// parentHwnd is the HWND of CView from MFC
m_parent = new QWinWidget(parentHwnd);
QMessageBox msg(m_parent);
msg.exec();
@Thanks
Roger -
As I know if parent is not null the message box will be window modal relative to the parent. But it still not solves (if I understand well the comment in the first line) why you can interact with the view.
-
Exec spinns a local event loop.But I'm not sure, whether this loop catches th windows event or sends them to the corresponding windows...
-
Thanks All, I find the cause: I should set parent window to main frame(instead of the view)