📄 afximpl.h
字号:
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) 1992-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#undef AFX_DATA
#define AFX_DATA AFX_CORE_DATA
/////////////////////////////////////////////////////////////////////////////
// Auxiliary System/Screen metrics
struct AUX_DATA
{
// system metrics
int cxVScroll, cyHScroll;
int cxIcon, cyIcon;
int cxBorder2, cyBorder2;
// device metrics for screen
int cxPixelsPerInch, cyPixelsPerInch;
// convenient system color
HBRUSH hbrWindowFrame;
HBRUSH hbrBtnFace;
// color values of system colors used for CToolBar
COLORREF clrBtnFace, clrBtnShadow, clrBtnHilite;
COLORREF clrBtnText, clrWindowFrame;
// standard cursors
HCURSOR hcurWait;
HCURSOR hcurArrow;
HCURSOR hcurHelp; // cursor used in Shift+F1 help
// special GDI objects allocated on demand
HFONT hStatusFont;
HFONT hToolTipsFont;
HBITMAP hbmMenuDot;
// other system information
UINT nWinVer; // Major.Minor version numbers
BOOL bWin95; // TRUE if Windows 95 (not NT)
BOOL bWin4; // TRUE if Windows 4.0
BOOL bNotWin4; // TRUE if not Windows 4.0
BOOL bSmCaption; // TRUE if WS_EX_SMCAPTION is supported
BOOL bMarked4; // TRUE if marked as 4.0
// Implementation
AUX_DATA();
~AUX_DATA();
void UpdateSysColors();
void UpdateSysMetrics();
};
extern AFX_DATA AUX_DATA afxData;
/////////////////////////////////////////////////////////////////////////////
// _AFX_CTL3D_STATE
#ifndef _AFX_NO_CTL3D_SUPPORT
#undef AFX_DATA
#define AFX_DATA
class _AFX_CTL3D_STATE : public CNoTrackObject
{
public:
virtual ~_AFX_CTL3D_STATE();
// setup during initialization
BOOL m_bCtl3dInited;
HINSTANCE m_hCtl3dLib;
// CTL3D32 entry points
BOOL (WINAPI* m_pfnRegister)(HINSTANCE);
BOOL (WINAPI* m_pfnUnregister)(HINSTANCE);
BOOL (WINAPI* m_pfnAutoSubclass)(HINSTANCE);
BOOL (WINAPI* m_pfnUnAutoSubclass)();
BOOL (WINAPI* m_pfnColorChange)();
BOOL (WINAPI* m_pfnSubclassDlgEx)(HWND, DWORD);
void (WINAPI* m_pfnWinIniChange)();
BOOL (WINAPI* m_pfnSubclassCtl)(HWND);
BOOL (WINAPI* m_pfnSubclassCtlEx)(HWND, int);
};
EXTERN_PROCESS_LOCAL(_AFX_CTL3D_STATE, _afxCtl3dState)
class _AFX_CTL3D_THREAD : public CNoTrackObject
{
public:
virtual ~_AFX_CTL3D_THREAD();
};
EXTERN_THREAD_LOCAL(_AFX_CTL3D_THREAD, _afxCtl3dThread)
_AFX_CTL3D_STATE* AFXAPI AfxGetCtl3dState();
#endif //!_AFX_NO_CTL3D_SUPPORT
/////////////////////////////////////////////////////////////////////////////
// _AFX_EDIT_STATE
class _AFX_EDIT_STATE : public CNoTrackObject
{
public:
_AFX_EDIT_STATE();
virtual ~_AFX_EDIT_STATE();
CFindReplaceDialog* pFindReplaceDlg; // find or replace dialog
BOOL bFindOnly; // Is pFindReplace the find or replace?
CString strFind; // last find string
CString strReplace; // last replace string
BOOL bCase; // TRUE==case sensitive, FALSE==not
int bNext; // TRUE==search down, FALSE== search up
BOOL bWord; // TRUE==match whole word, FALSE==not
};
#undef AFX_DATA
#define AFX_DATA AFX_CORE_DATA
class _AFX_RICHEDIT_STATE : public _AFX_EDIT_STATE
{
public:
HINSTANCE m_hInstRichEdit; // handle to RICHED32.DLL
virtual ~_AFX_RICHEDIT_STATE();
};
EXTERN_PROCESS_LOCAL(_AFX_RICHEDIT_STATE, _afxRichEditState)
_AFX_RICHEDIT_STATE* AFX_CDECL AfxGetRichEditState();
#undef AFX_DATA
#define AFX_DATA
////////////////////////////////////////////////////////////////////////////
// other global state
class CPushRoutingFrame
{
protected:
CFrameWnd* pOldRoutingFrame;
_AFX_THREAD_STATE* pThreadState;
public:
CPushRoutingFrame(CFrameWnd* pNewRoutingFrame)
{
pThreadState = AfxGetThreadState();
pOldRoutingFrame = pThreadState->m_pRoutingFrame;
pThreadState->m_pRoutingFrame = pNewRoutingFrame;
}
~CPushRoutingFrame()
{ pThreadState->m_pRoutingFrame = pOldRoutingFrame; }
};
class CPushRoutingView
{
protected:
CView* pOldRoutingView;
_AFX_THREAD_STATE* pThreadState;
public:
CPushRoutingView(CView* pNewRoutingView)
{
pThreadState = AfxGetThreadState();
pOldRoutingView = pThreadState->m_pRoutingView;
pThreadState->m_pRoutingView = pNewRoutingView;
}
~CPushRoutingView()
{ pThreadState->m_pRoutingView = pOldRoutingView; }
};
// Note: afxData.cxBorder and afxData.cyBorder aren't used anymore
#define CX_BORDER 1
#define CY_BORDER 1
// states for Shift+F1 hep mode
#define HELP_INACTIVE 0 // not in Shift+F1 help mode (must be 0)
#define HELP_ACTIVE 1 // in Shift+F1 help mode (non-zero)
#define HELP_ENTERING 2 // entering Shift+F1 help mode (non-zero)
/////////////////////////////////////////////////////////////////////////////
// Window class names and other window creation support
// from wincore.cpp
extern const TCHAR _afxWnd[]; // simple child windows/controls
extern const TCHAR _afxWndControlBar[]; // controls with gray backgrounds
extern const TCHAR _afxWndMDIFrame[];
extern const TCHAR _afxWndFrameOrView[];
extern const TCHAR _afxWndOleControl[];
#define AFX_WND_REG 0x00001
#define AFX_WNDCONTROLBAR_REG 0x00002
#define AFX_WNDMDIFRAME_REG 0x00004
#define AFX_WNDFRAMEORVIEW_REG 0x00008
#define AFX_WNDCOMMCTLS_REG 0x00010 // means all original Win95
#define AFX_WNDOLECONTROL_REG 0x00020
#define AFX_WNDCOMMCTL_UPDOWN_REG 0x00040 // these are original Win95
#define AFX_WNDCOMMCTL_TREEVIEW_REG 0x00080
#define AFX_WNDCOMMCTL_TAB_REG 0x00100
#define AFX_WNDCOMMCTL_PROGRESS_REG 0x00200
#define AFX_WNDCOMMCTL_LISTVIEW_REG 0x00400
#define AFX_WNDCOMMCTL_HOTKEY_REG 0x00800
#define AFX_WNDCOMMCTL_BAR_REG 0x01000
#define AFX_WNDCOMMCTL_ANIMATE_REG 0x02000
#define AFX_WNDCOMMCTL_INTERNET_REG 0x04000 // these are new in IE4
#define AFX_WNDCOMMCTL_COOL_REG 0x08000
#define AFX_WNDCOMMCTL_USEREX_REG 0x10000
#define AFX_WNDCOMMCTL_DATE_REG 0x20000
#define AFX_WIN95CTLS_MASK 0x03FC0 // UPDOWN -> ANIMATE
#define AFX_WNDCOMMCTLSALL_REG 0x3C010 // COMMCTLS|INTERNET|COOL|USEREX|DATE
#define AFX_WNDCOMMCTLSNEW_REG 0x3C000 // INTERNET|COOL|USEREX|DATE
#define AfxDeferRegisterClass(fClass) AfxEndDeferRegisterClass(fClass)
BOOL AFXAPI AfxEndDeferRegisterClass(LONG fToRegister);
// MFC has its own version of the TOOLINFO structure containing the
// the Win95 base version of the structure. Since MFC targets Win95 base,
// we need this structure so calls into that old library don't fail.
typedef struct tagAFX_OLDTOOLINFO {
UINT cbSize;
UINT uFlags;
HWND hwnd;
UINT uId;
RECT rect;
HINSTANCE hinst;
LPTSTR lpszText;
} AFX_OLDTOOLINFO;
// special AFX window class name mangling
#ifndef _UNICODE
#define _UNICODE_SUFFIX
#else
#define _UNICODE_SUFFIX _T("u")
#endif
#ifndef _DEBUG
#define _DEBUG_SUFFIX
#else
#define _DEBUG_SUFFIX _T("d")
#endif
#ifdef _AFXDLL
#define _STATIC_SUFFIX
#else
#define _STATIC_SUFFIX _T("s")
#endif
#define AFX_WNDCLASS(s) \
_T("Afx") _T(s) _T("42") _STATIC_SUFFIX _UNICODE_SUFFIX _DEBUG_SUFFIX
#define AFX_WND AFX_WNDCLASS("Wnd")
#define AFX_WNDCONTROLBAR AFX_WNDCLASS("ControlBar")
#define AFX_WNDMDIFRAME AFX_WNDCLASS("MDIFrame")
#define AFX_WNDFRAMEORVIEW AFX_WNDCLASS("FrameOrView")
#define AFX_WNDOLECONTROL AFX_WNDCLASS("OleControl")
// dialog/commdlg hook procs
BOOL CALLBACK AfxDlgProc(HWND, UINT, WPARAM, LPARAM);
UINT CALLBACK _AfxCommDlgProc(HWND hWnd, UINT, WPARAM, LPARAM);
// support for standard dialogs
extern UINT _afxMsgSETRGB;
typedef UINT (CALLBACK* COMMDLGPROC)(HWND, UINT, UINT, LONG);
/////////////////////////////////////////////////////////////////////////////
// Extended dialog templates (new in Win95)
#pragma pack(push, 1)
typedef struct
{
WORD dlgVer;
WORD signature;
DWORD helpID;
DWORD exStyle;
DWORD style;
WORD cDlgItems;
short x;
short y;
short cx;
short cy;
} DLGTEMPLATEEX;
typedef struct
{
DWORD helpID;
DWORD exStyle;
DWORD style;
short x;
short y;
short cx;
short cy;
DWORD id;
} DLGITEMTEMPLATEEX;
#pragma pack(pop)
/////////////////////////////////////////////////////////////////////////////
// Special helpers
void AFXAPI AfxCancelModes(HWND hWndRcvr);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -