77template<
typename DLG,
bool HASTASK = true>
102 m_dlg.SetParentMenu(hWnd, menuItem, msg);
122 return ::IsWindow(m_dlg.m_hWnd) && ::IsWindowVisible(m_dlg.m_hWnd);
133 m_dlg.ShowWindow(SW_SHOW);
147 m_dlg.ShowWindow(SW_HIDE);
173 if ( ::IsWindow(m_dlg.m_hWnd) )
175 m_dlg.DestroyWindow();
213 m_dlg.DisableWmClose();
217 void m_CreateDlg(
void)
219 if ( ! ::IsWindow(m_dlg.m_hWnd) )
221 m_dlg.CreateDlg(DLG::IDD, HASTASK ? CWnd::GetDesktopWindow() : NULL);
225 class CInner :
public DLG
230 CInner(
void) : m_hParentWnd(NULL)
231 , m_parentMenuItem(0), m_parentMsg(0), m_isPosChanging(false), m_isCreating(false), m_isEnableWmClose(true)
234 void CreateDlg(DWORD dw,
CWnd* pParent)
236 if ( ! ::IsWindow(_super::m_hWnd) )
239 _super::Create(dw, pParent);
242 DWORD mov = WS_CHILD | WS_VISIBLE;
243 DWORD add = WS_POPUP;
244 _super::ModifyStyle(mov, add, SWP_FRAMECHANGED);
245 m_isCreating =
false;
257 m_parentMenuItem = menuItem;
263 m_isEnableWmClose =
false;
275 virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
280 case WM_WINDOWPOSCHANGING:
281 if ( ! m_isCreating )
283 m_isPosChanging =
true;
286 case WM_WINDOWPOSCHANGED:
287 if ( m_isPosChanging )
289 m_isPosChanging =
false;
290 WINDOWPOS* P =
reinterpret_cast<WINDOWPOS*
>(lParam);
291 if ( (P->flags & SWP_HIDEWINDOW) != 0 )
298 if ( ! m_isCreating )
300 m_isPosChanging =
false;
301 m_NotifyParent(wParam);
306 if ( m_isEnableWmClose )
313 return _super::WindowProc(message, wParam, lParam);
317 UINT m_parentMenuItem;
319 bool m_isPosChanging;
321 bool m_isEnableWmClose;
323 void m_NotifyParent(WPARAM wParam)
325 if ( m_parentMenuItem != 0 )
327 HMENU h = ::GetMenu(m_hParentWnd);
330 UINT r = (wParam != 0) ? MF_CHECKED : MF_UNCHECKED;
331 ::CheckMenuItem(h, m_parentMenuItem, r);
334 if ( m_parentMsg != 0 && wParam == 0 )
336 ::PostMessage(m_hParentWnd, m_parentMsg, 0, 0);
bool IsVisible(void) const
[取得] 表示状態
void DisableWmClose(void)
[設定] WM_CLOSE 処理禁止.
void Destroy(void)
[設定] 破棄.
void SetParentMenu(HWND hWnd, UINT menuItem, UINT msg=0)
[設定] 親メニュー設定.
DLG * operator->(void)
[取得] ダイアログクラス参照
bool IsViewing(void) const
[取得] 表示状態
CModelessDialogT(void)
コンストラクタ
~CModelessDialogT(void)
デストラクタ
const DLG * operator->(void) const
[取得] ダイアログクラス参照
void Toggle(void)
[設定] 表示/非表示.