本文整理汇总了C++中CWinApp::EnableModeless方法的典型用法代码示例。如果您正苦于以下问题:C++ CWinApp::EnableModeless方法的具体用法?C++ CWinApp::EnableModeless怎么用?C++ CWinApp::EnableModeless使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWinApp
的用法示例。
在下文中一共展示了CWinApp::EnableModeless方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowModal
BOOL CXTPPopupControl::ShowModal(CWnd* pParent)
{
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->EnableModeless(FALSE);
HWND hWndTop = 0;
#if (_MSC_VER <= 1100)
CWnd* pParentWnd = CWnd::GetSafeOwner(pParent, &hWndTop);
HWND hWndParent = pParentWnd->GetSafeHwnd();
#else
HWND hWndParent = CWnd::GetSafeOwner_(pParent->GetSafeHwnd(), &hWndTop);
#endif
BOOL bEnableParent = FALSE;
if (hWndParent != NULL && ::IsWindowEnabled(hWndParent))
{
::EnableWindow(hWndParent, FALSE);
bEnableParent = TRUE;
}
//create popup wnd
if (Show(pParent))
{
SetFocus();
RunModalLoop(MLF_NOIDLEMSG | MLF_NOKICKIDLE);
}
if (bEnableParent)
::EnableWindow(hWndParent, TRUE);
if (hWndParent != NULL && ::GetActiveWindow() == m_hWnd)
::SetActiveWindow(hWndParent);
DestroyWindow();
// re-enable windows
if (::IsWindow(hWndTop))
::EnableWindow(hWndTop, TRUE);
hWndTop = NULL;
if (pApp != NULL)
pApp->EnableModeless(TRUE);
return TRUE;
}
示例2: PostModal
void CDialog::PostModal()
{
AfxUnhookWindowCreate(); // just in case
Detach(); // just in case
// re-enable windows
if (::IsWindow(m_hWndTop))
::EnableWindow(m_hWndTop, TRUE);
m_hWndTop = NULL;
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->EnableModeless(TRUE);
}
示例3: PreModal
HWND CDialog::PreModal()
{
// cannot call DoModal on a dialog already constructed as modeless
ASSERT(m_hWnd == NULL);
// allow OLE servers to disable themselves
CWinApp* pApp = AfxGetApp();
if (pApp != NULL)
pApp->EnableModeless(FALSE);
// find parent HWND
HWND hWnd = CWnd::GetSafeOwner_(m_pParentWnd->GetSafeHwnd(), &m_hWndTop);
// hook for creation of dialog
AfxHookWindowCreate(this);
// return window to use as parent for dialog
return hWnd;
}