Duilib 模态对话框和非模态对话框
来源:互联网 发布:c语言标准库函数 下载 编辑:程序博客网 时间:2024/04/29 01:45
- void CMainDlg::DoTask()
- {
- CTaskDlg * pDlg = NULL;
- pDlg = new CTaskDlg(XML_FILE_NAME_TASK_DLG, WND_CLASS_NAME_TASK_DLG);
- pDlg->Create(this->m_hWnd, MAIN_RORG_DISP_NAME, UI_WNDSTYLE_FRAME, WS_EX_WINDOWEDGE); ///< 如果参数1是NULL, 为桌面, 子窗口就不是模态对话框
- pDlg->CenterWindow();
- pDlg->ShowModal(); ///< 弹出的是模态窗口
- }
因为要弹出模态对话框, 跟进 pDlg->ShowModal(), 看到了duilib禁止主窗口的代码, 才想到参数1应为父窗口窗口句柄.
可以看出, 当要弹出非模态窗口时, 可以将pDlg->Create 的参数1 填成 NULL.
- UINT CWindowWnd::ShowModal()
- {
- ASSERT(::IsWindow(m_hWnd));
- UINT nRet = 0;
- HWND hWndParent = GetWindowOwner(m_hWnd); ///< 如果子窗口创建时,参数1为NULL, 这里得到的 hWndParent 就为 NULL
- ::ShowWindow(m_hWnd, SW_SHOWNORMAL);
- ::EnableWindow(hWndParent, FALSE); ///< 当 (NULL == hWndParent) 时, EnableWindow 不生效, 导致弹出的是非模态窗口.
- MSG msg = { 0 };
- while( ::IsWindow(m_hWnd) && ::GetMessage(&msg, NULL, 0, 0) ) {
- if( msg.message == WM_CLOSE && msg.hwnd == m_hWnd ) {
- nRet = msg.wParam;
- ::EnableWindow(hWndParent, TRUE);
- ::SetFocus(hWndParent);
- }
- if( !CPaintManagerUI::TranslateMessage(&msg) ) {
- ::TranslateMessage(&msg);
- ::DispatchMessage(&msg);
- }
- if( msg.message == WM_QUIT ) break;
- }
- ::EnableWindow(hWndParent, TRUE);
- ::SetFocus(hWndParent);
- if( msg.message == WM_QUIT ) ::PostQuitMessage(msg.wParam);
- return nRet;
- }
0 0
- Duilib 模态对话框和非模态对话框
- 对话框1----建立模态对话框和非模态对话框
- MFC 对话框类、非模态对话框和模态对话框
- 模态对话框和非模态对话框
- vc 模态对话框和非模态对话框
- 模态对话框和非模态对话框
- 模态对话框和非模态对话框
- 模态对话框和非模态对话框
- 模态对话框和非模态对话框区别
- VC++模态对话框和非模态对话框
- MFC模态对话框和非模态对话框
- MFC模态对话框和非模态对话框
- QT 模态对话框和非模态对话框
- QT 模态对话框和非模态对话框
- MFC模态对话框和非模态对话框
- VC++模态对话框和非模态对话框
- MFC 模态对话框和非模态对话框
- 模态对话框和非模态对话框
- PHP使用Selenium
- linux用户程序是怎么和驱动程序联系起来ioctl/write
- System.arraycopy
- 日志
- Ubuntu下安装Code Blocks
- Duilib 模态对话框和非模态对话框
- 为Sublime Text安装smali代码语法高亮插件
- hdu_1020_Encoding(模拟)
- JS+CSS弹出框
- mysql_控制台基本使用
- C中的volatile用法
- Target runtime Apache Tomcat v6.0 is not defined.错误解决方法
- Android关于PagerAdapter的使用方法的总结
- 关于ViewRootImpl中measure相关代码的分析