diff options
author | Stef Walter <stef@thewalter.net> | 2003-09-17 19:07:23 +0000 |
---|---|---|
committer | Stef Walter <stef@thewalter.net> | 2003-09-17 19:07:23 +0000 |
commit | 3f95d417d9e623ac0c74df8ef11d7a01846392dd (patch) | |
tree | 45ec73f2dc07eafd7f41a6f62a8cdfbaa279469f /NSCmpts/PromptClose.h |
Diffstat (limited to 'NSCmpts/PromptClose.h')
-rw-r--r-- | NSCmpts/PromptClose.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/NSCmpts/PromptClose.h b/NSCmpts/PromptClose.h new file mode 100644 index 0000000..a10c058 --- /dev/null +++ b/NSCmpts/PromptClose.h @@ -0,0 +1,51 @@ +// PromptClose.h: interface for the CPromptClose class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_PROMPTCLOSE_H__5BB78C71_C041_11D3_8306_005056C1D336__INCLUDED_) +#define AFX_PROMPTCLOSE_H__5BB78C71_C041_11D3_8306_005056C1D336__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include <atlwinhk.h> + +template <class TBase = CWindow> +class CPromptCloseT : public CWindowImplBaseT< TBase > +{ +public: + CPromptCloseT() + { + m_nIDRet = IDCANCEL; + } + + bool CloseNext(UINT nRet) + { + m_nIDRet = nRet; + _Module.AddCreateWndData(&m_thunk.cd, this); + return HOOK_AND_SUBCLASS_NEXT() ? true : false; + } + + +BEGIN_MSG_MAP(CPromptCloseT<TBase>) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) +END_MSG_MAP() + + DECLARE_HOOK_AND_SUBCLASS(CPromptCloseT<TBase>) + + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + { + EndDialog(m_hWnd, m_nIDRet); + UnsubclassWindow(); + // Hide this Dialog + return TRUE; + } + +protected: + UINT m_nIDRet; +}; + +typedef CPromptCloseT<CWindow> CPromptClose; + +#endif // !defined(AFX_PROMPTCLOSE_H__5BB78C71_C041_11D3_8306_005056C1D336__INCLUDED_) |