📄 wtl4mfc.h
字号:
#pragma once
extern "C"
{
HIMAGELIST WINAPI ImageList_Read(LPSTREAM pstm);
BOOL WINAPI ImageList_Write(HIMAGELIST himl, LPSTREAM pstm);
#if (_WIN32_WINNT >= 0x0501)
HRESULT WINAPI ImageList_ReadEx(DWORD dwFlags, LPSTREAM pstm, REFIID riid, PVOID* ppv);
HRESULT WINAPI ImageList_WriteEx(HIMAGELIST himl, DWORD dwFlags, LPSTREAM pstm);
#endif
};
#include <cassert>
#include <algorithm>
#include <functional>
#include <numeric>
#include <set>
#include <memory>
#include <deque>
#include <sstream>
#include <vector>
#include <queue>
#include <map>
#include <list>
#include <utility>
#include <cmath>
#include <limits>
#include <iomanip>
#define _CSTRING_NS
#define _WTL_NO_AUTOMATIC_NAMESPACE
#define _WTL_NO_CSTRING
#pragma push_macro("CopyCursor")
#include <atlbase.h>
#include <atlapp.h>
#pragma pop_macro("CopyCursor")
extern CComModule _Module;
//DO NOT include these header files to avoid conflict between ATL & MFC
//#include <atlmisc.h>
//#include <atlstr.h>
#define _WTL_USE_CSTRING
#define __ATLMISC_H__
#define __ATLSTR_H__
typedef CString CAtlString;
#include <atlutil.h>
#include <atlcoll.h>
#include <atlwin.h>
#include <atlctrls.h>
#include <atlctrlx.h>
#include <atlcrack.h>
#include <atlframe.h>
#include <atlimage.h>
#include <atlsplit.h>
#if (_WIN32_WINNT >= 0x0501)
# include <atltheme.h>
#endif
#define _BEGIN_WTL4MFC_NAMESPACE namespace WTL4MFC {
#define _END_WTL4MFC_NAMESPACE }
_BEGIN_WTL4MFC_NAMESPACE
template<class TMFCWnd, class TWTLCWindow>
class ATL_NO_VTABLE CWTL4MFCWndT : public TMFCWnd
{
public:
typedef TWTLCWindow WTLClass;
WTLClass m_wndWTLPeer;
virtual void PreSubclassWindow()
{
m_wndWTLPeer.m_hWnd = m_hWnd;
__super::PreSubclassWindow();
}
virtual void PostNcDestroy()
{
if(::GetActiveWindow() == m_wndWTLPeer.m_hWnd)
{
// Is this a bug of Windows, anyway let protect ourselves
VERIFY(::SetActiveWindow(NULL));
}
m_wndWTLPeer.m_hWnd = NULL;
__super::PostNcDestroy();
}
virtual LRESULT WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT lResult = 0;
if(FALSE == m_wndWTLPeer.ProcessWindowMessage(m_hWnd, nMsg, wParam, lParam, lResult))
{
ASSERT(::IsWindow(m_hWnd));
lResult = TMFCWnd::WindowProc(nMsg, wParam, lParam);
}
return lResult;
}
__if_exists(TWTLCWindow::PreTranslateMessage) {
virtual BOOL PreTranslateMessage(MSG* pMsg)
{
BOOL blRes1 = __super::PreTranslateMessage(pMsg);
BOOL blRes2 = m_wndWTLPeer.PreTranslateMessage(pMsg);
// if both WTL & MFC handle this message
// there maybe a problem, consider to override this method in derived class
ASSERT(FALSE == (blRes2 && blRes1));
return (blRes1 | blRes2);
}}
};
_END_WTL4MFC_NAMESPACE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -