MFC相談室 mfc22d.dll
■ このスレッドは過去ログ倉庫に格納されています
0117営利利用に関するLR審議中@詳細は自治スレへ
2012/04/10(火) 21:13:49.42BOOL CMyFrameWnd::OpenAndHide(CWnd* pwndParent, BOOL* pbIsDestroyed)
{
// LoadFrameの引数の親ウィンドウへのポインタにはpwndParentを渡さずNULLにしておく
if( (pwndParent == NULL) || (LoadFrame(〜) == FALSE) || AddDocTemplate(〜) == FALSE) ) return FALSE;
// pwndParentを消す
pwndParent->ShowWindow(SW_HIDE);
LONG lExStyleOfParent = m_lExStyleOfParent = ::GetWindowLong(pwndParent->m_hWnd, GWL_EXSTYLE);
lExStyleOfParent &= (~WS_EX_APPWINDOW);
lExStyleOfParent |= WS_EX_TOOLWINDOW;
::SetWindowLong(pwndParent->m_hWnd, GWL_EXSTYLE, lExStyleOfParent);
::SetWindowPos(pwndParent->m_hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
::SetWindowRgn(pwndParent->m_hWnd, CreateRectRgn(0, 0, 0, 0), TRUE);
// ポインタをメンバ変数に記録
m_pwndParent = pwndParent;
if(pbIsDestroyed != NULL){
m_pbIsDestroyed = pbIsDestroyed;
(*m_pbIsDestroyed) = FALSE;
}
ShowWindow(SW_SHOW);
return TRUE;
}
void CMyFrameWnd::OnDestroy()
{
if(m_pbIsDestroyed != NULL) (*m_pbIsDestroyed) = TRUE;
else{
::SetWindowLong(m_pwndParent->m_hWnd, GWL_EXSTYLE, m_lExStyleOfParent);
::SetWindowPos(m_pwndParent->m_hWnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
::SetWindowRgn(m_pwndParent->m_hWnd, NULL, TRUE);
}
CWnd::OnDestroy();
}
■ このスレッドは過去ログ倉庫に格納されています