📄 afxwin.h
字号:
#include <afxdd_.h> // standard DDX_ and DDV_ routines
/////////////////////////////////////////////////////////////////////////////
// OLE types
typedef LONG HRESULT;
struct IUnknown;
typedef IUnknown* LPUNKNOWN;
struct IDispatch;
typedef IDispatch* LPDISPATCH;
struct IConnectionPoint;
typedef IConnectionPoint* LPCONNECTIONPOINT;
struct IEnumOLEVERB;
typedef IEnumOLEVERB* LPENUMOLEVERB;
typedef struct _GUID GUID;
typedef GUID IID;
typedef GUID CLSID;
#ifndef _REFCLSID_DEFINED
#define REFCLSID const CLSID &
#endif
typedef long DISPID;
typedef unsigned short VARTYPE;
typedef long SCODE;
#if defined(WIN32) && !defined(OLE2ANSI)
typedef WCHAR OLECHAR;
#else
typedef char OLECHAR;
#endif
typedef OLECHAR* BSTR;
struct tagDISPPARAMS;
typedef tagDISPPARAMS DISPPARAMS;
struct tagVARIANT;
typedef tagVARIANT VARIANT;
struct ITypeInfo;
typedef ITypeInfo* LPTYPEINFO;
struct ITypeLib;
typedef ITypeLib* LPTYPELIB;
/////////////////////////////////////////////////////////////////////////////
// CCmdTarget
// private structures
struct AFX_CMDHANDLERINFO; // info about where the command is handled
struct AFX_EVENT; // info about an event
class CTypeLibCache; // cache for OLE type libraries
/////////////////////////////////////////////////////////////////////////////
// OLE interface map handling (more in AFXDISP.H)
#ifndef _AFX_NO_OLE_SUPPORT
struct AFX_INTERFACEMAP_ENTRY
{
const void* piid; // the interface id (IID) (NULL for aggregate)
size_t nOffset; // offset of the interface vtable from m_unknown
};
struct AFX_INTERFACEMAP
{
#ifdef _AFXDLL
const AFX_INTERFACEMAP* (PASCAL* pfnGetBaseMap)(); // NULL is root class
#else
const AFX_INTERFACEMAP* pBaseMap;
#endif
const AFX_INTERFACEMAP_ENTRY* pEntry; // map for this class
};
#ifdef _AFXDLL
#define DECLARE_INTERFACE_MAP() \
private: \
static const AFX_INTERFACEMAP_ENTRY _interfaceEntries[]; \
protected: \
static AFX_DATA const AFX_INTERFACEMAP interfaceMap; \
static const AFX_INTERFACEMAP* PASCAL _GetBaseInterfaceMap(); \
virtual const AFX_INTERFACEMAP* GetInterfaceMap() const; \
#else
#define DECLARE_INTERFACE_MAP() \
private: \
static const AFX_INTERFACEMAP_ENTRY _interfaceEntries[]; \
protected: \
static AFX_DATA const AFX_INTERFACEMAP interfaceMap; \
virtual const AFX_INTERFACEMAP* GetInterfaceMap() const; \
#endif
#endif //!_AFX_NO_OLE_SUPPORT
/////////////////////////////////////////////////////////////////////////////
// OLE dispatch map handling (more in AFXDISP.H)
#ifndef _AFX_NO_OLE_SUPPORT
struct AFX_DISPMAP_ENTRY;
struct AFX_DISPMAP
{
#ifdef _AFXDLL
const AFX_DISPMAP* (PASCAL* pfnGetBaseMap)();
#else
const AFX_DISPMAP* pBaseMap;
#endif
const AFX_DISPMAP_ENTRY* lpEntries;
UINT* lpEntryCount;
DWORD* lpStockPropMask;
};
#ifdef _AFXDLL
#define DECLARE_DISPATCH_MAP() \
private: \
static const AFX_DISPMAP_ENTRY _dispatchEntries[]; \
static UINT _dispatchEntryCount; \
static DWORD _dwStockPropMask; \
protected: \
static AFX_DATA const AFX_DISPMAP dispatchMap; \
static const AFX_DISPMAP* PASCAL _GetBaseDispatchMap(); \
virtual const AFX_DISPMAP* GetDispatchMap() const; \
#else
#define DECLARE_DISPATCH_MAP() \
private: \
static const AFX_DISPMAP_ENTRY _dispatchEntries[]; \
static UINT _dispatchEntryCount; \
static DWORD _dwStockPropMask; \
protected: \
static AFX_DATA const AFX_DISPMAP dispatchMap; \
virtual const AFX_DISPMAP* GetDispatchMap() const; \
#endif
#endif //!_AFX_NO_OLE_SUPPORT
/////////////////////////////////////////////////////////////////////////////
// OLE Document Object command target handling
#ifndef _AFX_NO_DOCOBJECT_SUPPORT
struct AFX_OLECMDMAP_ENTRY
{
const GUID* pguid; // id of the command group
ULONG cmdID; // OLECMD ID
UINT nID; // corresponding WM_COMMAND message ID
};
struct AFX_OLECMDMAP
{
#ifdef _AFXDLL
const AFX_OLECMDMAP* (PASCAL* pfnGetBaseMap)();
#else
const AFX_OLECMDMAP* pBaseMap;
#endif
const AFX_OLECMDMAP_ENTRY* lpEntries;
};
#ifdef _AFXDLL
#define DECLARE_OLECMD_MAP() \
private: \
static const AFX_OLECMDMAP_ENTRY _commandEntries[]; \
protected: \
static AFX_DATA const AFX_OLECMDMAP commandMap; \
static const AFX_OLECMDMAP* PASCAL _GetBaseCommandMap(); \
virtual const AFX_OLECMDMAP* GetCommandMap() const; \
#else
#define DECLARE_OLECMD_MAP() \
private: \
static const AFX_OLECMDMAP_ENTRY _commandEntries[]; \
protected: \
static AFX_DATA const AFX_OLECMDMAP commandMap; \
virtual const AFX_OLECMDMAP* GetCommandMap() const; \
#endif
#ifdef _AFXDLL
#define BEGIN_OLECMD_MAP(theClass, baseClass) \
const AFX_OLECMDMAP* PASCAL theClass::_GetBaseCommandMap() \
{ return &baseClass::commandMap; } \
const AFX_OLECMDMAP* theClass::GetCommandMap() const \
{ return &theClass::commandMap; } \
AFX_COMDAT AFX_DATADEF const AFX_OLECMDMAP theClass::commandMap = \
{ &theClass::_GetBaseCommandMap, &theClass::_commandEntries[0] }; \
AFX_COMDAT const AFX_OLECMDMAP_ENTRY theClass::_commandEntries[] = \
{ \
#else
#define BEGIN_OLECMD_MAP(theClass, baseClass) \
const AFX_OLECMDMAP* theClass::GetCommandMap() const \
{ return &theClass::commandMap; } \
AFX_COMDAT AFX_DATADEF const AFX_OLECMDMAP theClass::commandMap = \
{ &baseClass::commandMap, &theClass::_commandEntries[0] }; \
AFX_COMDAT const AFX_OLECMDMAP_ENTRY theClass::_commandEntries[] = \
{ \
#endif
#define END_OLECMD_MAP() \
{NULL, 0, 0} \
}; \
class COleCmdUI;
#endif //!_AFX_NO_DOCOBJECT_SUPPORT
/////////////////////////////////////////////////////////////////////////////
// OLE event sink map handling (more in AFXDISP.H)
#ifndef _AFX_NO_OCC_SUPPORT
struct AFX_EVENTSINKMAP_ENTRY;
struct AFX_EVENTSINKMAP
{
#ifdef _AFXDLL
const AFX_EVENTSINKMAP* (PASCAL* pfnGetBaseMap)();
#else
const AFX_EVENTSINKMAP* pBaseMap;
#endif
const AFX_EVENTSINKMAP_ENTRY* lpEntries;
UINT* lpEntryCount;
};
#ifdef _AFXDLL
#define DECLARE_EVENTSINK_MAP() \
private: \
static const AFX_EVENTSINKMAP_ENTRY _eventsinkEntries[]; \
static UINT _eventsinkEntryCount; \
protected: \
static AFX_DATA const AFX_EVENTSINKMAP eventsinkMap; \
static const AFX_EVENTSINKMAP* PASCAL _GetBaseEventSinkMap(); \
virtual const AFX_EVENTSINKMAP* GetEventSinkMap() const; \
#else
#define DECLARE_EVENTSINK_MAP() \
private: \
static const AFX_EVENTSINKMAP_ENTRY _eventsinkEntries[]; \
static UINT _eventsinkEntryCount; \
protected: \
static AFX_DATA const AFX_EVENTSINKMAP eventsinkMap; \
virtual const AFX_EVENTSINKMAP* GetEventSinkMap() const; \
#endif
#endif //!_AFX_NO_OCC_SUPPORT
/////////////////////////////////////////////////////////////////////////////
// OLE connection map handling (more in AFXDISP.H)
#ifndef _AFX_NO_OLE_SUPPORT
struct AFX_CONNECTIONMAP_ENTRY
{
const void* piid; // the interface id (IID)
size_t nOffset; // offset of the interface vtable from m_unknown
};
struct AFX_CONNECTIONMAP
{
#ifdef _AFXDLL
const AFX_CONNECTIONMAP* (PASCAL* pfnGetBaseMap)(); // NULL is root class
#else
const AFX_CONNECTIONMAP* pBaseMap;
#endif
const AFX_CONNECTIONMAP_ENTRY* pEntry; // map for this class
};
#ifdef _AFXDLL
#define DECLARE_CONNECTION_MAP() \
private: \
static const AFX_CONNECTIONMAP_ENTRY _connectionEntries[]; \
protected: \
static AFX_DATA const AFX_CONNECTIONMAP connectionMap; \
static const AFX_CONNECTIONMAP* PASCAL _GetBaseConnectionMap(); \
virtual const AFX_CONNECTIONMAP* GetConnectionMap() const; \
#else
#define DECLARE_CONNECTION_MAP() \
private: \
static const AFX_CONNECTIONMAP_ENTRY _connectionEntries[]; \
protected: \
static AFX_DATA const AFX_CONNECTIONMAP connectionMap; \
virtual const AFX_CONNECTIONMAP* GetConnectionMap() const; \
#endif
#endif //!_AFX_NO_OLE_SUPPORT
/////////////////////////////////////////////////////////////////////////////
// CCmdTarget proper
#ifndef _AFX_NO_OCC_SUPPORT
class COccManager; // forward reference (see ..\src\occimpl.h)
#endif
#ifdef _AFXDLL
class CCmdTarget : public CObject
#else
class AFX_NOVTABLE CCmdTarget : public CObject
#endif
{
DECLARE_DYNAMIC(CCmdTarget)
protected:
public:
// Constructors
CCmdTarget();
// Attributes
LPDISPATCH GetIDispatch(BOOL bAddRef);
// retrieve IDispatch part of CCmdTarget
static CCmdTarget* PASCAL FromIDispatch(LPDISPATCH lpDispatch);
// map LPDISPATCH back to CCmdTarget* (inverse of GetIDispatch)
BOOL IsResultExpected();
// returns TRUE if automation function should return a value
// Operations
void EnableAutomation();
// call in constructor to wire up IDispatch
void EnableConnections();
// call in constructor to wire up IConnectionPointContainer
void BeginWaitCursor();
void EndWaitCursor();
void RestoreWaitCursor(); // call after messagebox
#ifndef _AFX_NO_OLE_SUPPORT
// dispatch OLE verbs through the message map
BOOL EnumOleVerbs(LPENUMOLEVERB* ppenumOleVerb);
BOOL DoOleVerb(LONG iVerb, LPMSG lpMsg, HWND hWndParent, LPCRECT lpRect);
#endif
// Overridables
// route and dispatch standard command message types
// (more sophisticated than OnCommand)
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
AFX_CMDHANDLERINFO* pHandlerInfo);
#ifndef _AFX_NO_OLE_SUPPORT
// called when last OLE reference is released
virtual void OnFinalRelease();
#endif
#ifndef _AFX_NO_OLE_SUPPORT
// called before dispatching to an automation handler function
virtual BOOL IsInvokeAllowed(DISPID dispid);
#endif
#ifndef _AFX_NO_OLE_SUPPORT
// support for OLE type libraries
void EnableTypeLib();
HRESULT GetTypeInfoOfGuid(LCID lcid, const GUID& guid,
LPTYPEINFO* ppTypeInfo);
virtual BOOL GetDispatchIID(IID* pIID);
virtual UINT GetTypeInfoCount();
virtual CTypeLibCache* GetTypeLibCache();
virtual HRESULT GetTypeLib(LCID lcid, LPTYPELIB* ppTypeLib);
#endif
// Implementation
public:
virtual ~CCmdTarget();
#ifdef _DEBUG
virtual void Dump(CDumpContext& dc) const;
virtual void AssertValid() const;
#endif
#ifndef _AFX_NO_OLE_SUPPORT
void GetNotSupported();
void SetNotSupported();
#endif
protected:
friend class CView;
CView* GetRoutingView();
CFrameWnd* GetRoutingFrame();
static CView* PASCAL GetRoutingView_();
static CFrameWnd* PASCAL GetRoutingFrame_();
DECLARE_MESSAGE_MAP() // base class - no {{ }} macros
#ifndef _AFX_NO_DOCOBJECT_SUPPORT
DECLARE_OLECMD_MAP()
friend class COleCmdUI;
#endif
#ifndef _AFX_NO_OLE_SUPPORT
DECLARE_DISPATCH_MAP()
DECLARE_CONNECTION_MAP()
DECLARE_INTERFACE_MAP()
#ifndef _AFX_NO_OCC_SUPPORT
DECLARE_EVENTSINK_MAP()
#endif // !_AFX_NO_OCC_SUPPORT
// OLE interface map implementation
public:
// data used when CCmdTarget is made OLE aware
long m_dwRef;
LPUNKNOWN m_pOuterUnknown; // external controlling unknown if != NULL
DWORD m_xInnerUnknown; // place-holder for inner controlling unknown
public:
// advanced operations
void EnableAggregation(); // call to enable aggregation
void ExternalDisconnect(); // forcibly disconnect
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -