?? afxdisp.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.
#ifndef __AFXDISP_H__
#define __AFXDISP_H__
#ifdef _AFX_NO_OLE_SUPPORT
#error OLE classes not supported in this library variant.
#endif
#ifndef __AFXWIN_H__
#include <afxwin.h>
#endif
// include necessary OLE headers
#ifndef _OBJBASE_H_
#include <objbase.h>
#endif
#ifndef _OLEAUTO_H_
#include <oleauto.h>
#endif
#ifndef _OLECTL_H_
#include <olectl.h>
#endif
#ifndef __ocidl_h__
#include <ocidl.h>
#endif
// Shell interface support
#ifndef _SHLOBJ_H_
#include <shlobj.h>
#endif
#ifdef _AFX_MINREBUILD
#pragma component(minrebuild, off)
#endif
#ifndef _AFX_FULLTYPEINFO
#pragma component(mintypeinfo, on)
#endif
#ifndef _AFX_NOFORCE_LIBS
/////////////////////////////////////////////////////////////////////////////
// Win32 libraries
#ifdef _AFXDLL
#if defined(_DEBUG) && !defined(_AFX_MONOLITHIC)
#ifndef _UNICODE
#pragma comment(lib, "mfco42d.lib")
#else
#pragma comment(lib, "mfco42ud.lib")
#endif
#endif
#endif
#pragma comment(lib, "oledlg.lib")
#pragma comment(lib, "ole32.lib")
#pragma comment(lib, "olepro32.lib")
#pragma comment(lib, "oleaut32.lib")
#pragma comment(lib, "uuid.lib")
#pragma comment(lib, "urlmon.lib")
#endif //!_AFX_NOFORCE_LIBS
/////////////////////////////////////////////////////////////////////////////
#ifdef _AFX_PACKING
#pragma pack(push, _AFX_PACKING)
#endif
/////////////////////////////////////////////////////////////////////////////
// AFXDISP - MFC IDispatch & ClassFactory support
// Classes declared in this file
//CException
class COleException; // caught by client or server
class COleDispatchException; // special exception for IDispatch calls
//CCmdTarget
class COleObjectFactory; // glue for IClassFactory -> runtime class
class COleTemplateServer; // server documents using CDocTemplate
class COleDispatchDriver; // helper class to call IDispatch
class COleVariant; // OLE VARIANT wrapper
class COleCurrency; // Based on OLE CY
class COleDateTime; // Based on OLE DATE
class COleDateTimeSpan; // Based on a double
class COleSafeArray; // Based on OLE VARIANT
/////////////////////////////////////////////////////////////////////////////
// AFXDLL support
#undef AFX_DATA
#define AFX_DATA AFX_OLE_DATA
/////////////////////////////////////////////////////////////////////////////
// OLE COM (Component Object Model) implementation infrastructure
// - data driven QueryInterface
// - standard implementation of aggregate AddRef and Release
// (see CCmdTarget in AFXWIN.H for more information)
#define METHOD_PROLOGUE(theClass, localClass) \
theClass* pThis = \
((theClass*)((BYTE*)this - offsetof(theClass, m_x##localClass))); \
AFX_MANAGE_STATE(pThis->m_pModuleState) \
pThis; // avoid warning from compiler \
#define METHOD_PROLOGUE_(theClass, localClass) \
theClass* pThis = \
((theClass*)((BYTE*)this - offsetof(theClass, m_x##localClass))); \
pThis; // avoid warning from compiler \
#ifndef _AFX_NO_NESTED_DERIVATION
#define METHOD_PROLOGUE_EX(theClass, localClass) \
theClass* pThis = ((theClass*)((BYTE*)this - m_nOffset)); \
AFX_MANAGE_STATE(pThis->m_pModuleState) \
pThis; // avoid warning from compiler \
#define METHOD_PROLOGUE_EX_(theClass, localClass) \
theClass* pThis = ((theClass*)((BYTE*)this - m_nOffset)); \
pThis; // avoid warning from compiler \
#else
#define METHOD_PROLOGUE_EX(theClass, localClass) \
METHOD_PROLOGUE(theClass, localClass) \
#define METHOD_PROLOGUE_EX_(theClass, localClass) \
METHOD_PROLOGUE_(theClass, localClass) \
#endif
// Provided only for compatibility with CDK 1.x
#define METHOD_MANAGE_STATE(theClass, localClass) \
METHOD_PROLOGUE_EX(theClass, localClass) \
#define BEGIN_INTERFACE_PART(localClass, baseClass) \
class X##localClass : public baseClass \
{ \
public: \
STDMETHOD_(ULONG, AddRef)(); \
STDMETHOD_(ULONG, Release)(); \
STDMETHOD(QueryInterface)(REFIID iid, LPVOID* ppvObj); \
#ifndef _AFX_NO_NESTED_DERIVATION
#define BEGIN_INTERFACE_PART_DERIVE(localClass, baseClass) \
class X##localClass : public baseClass \
{ \
public: \
#else
#define BEGIN_INTERFACE_PART_DERIVE(localClass, baseClass) \
BEGIN_INTERFACE_PART(localClass, baseClass) \
#endif
#ifndef _AFX_NO_NESTED_DERIVATION
#define INIT_INTERFACE_PART(theClass, localClass) \
size_t m_nOffset; \
INIT_INTERFACE_PART_DERIVE(theClass, localClass) \
#define INIT_INTERFACE_PART_DERIVE(theClass, localClass) \
X##localClass() \
{ m_nOffset = offsetof(theClass, m_x##localClass); } \
#else
#define INIT_INTERFACE_PART(theClass, localClass)
#define INIT_INTERFACE_PART_DERIVE(theClass, localClass)
#endif
// Note: Inserts the rest of OLE functionality between these two macros,
// depending upon the interface that is being implemented. It is not
// necessary to include AddRef, Release, and QueryInterface since those
// member functions are declared by the macro.
#define END_INTERFACE_PART(localClass) \
} m_x##localClass; \
friend class X##localClass; \
struct CInterfacePlaceHolder
{
DWORD m_vtbl; // filled in with USE_INTERFACE_PART
CInterfacePlaceHolder() { m_vtbl = 0; }
};
#define END_INTERFACE_PART_OPTIONAL(localClass) \
}; \
CInterfacePlaceHolder m_x##localClass; \
friend class X##localClass; \
#ifdef _AFXDLL
#define END_INTERFACE_PART_STATIC END_INTERFACE_PART
#else
#define END_INTERFACE_PART_STATIC END_INTERFACE_PART
#endif
#define USE_INTERFACE_PART(localClass) \
m_x##localClass.m_vtbl = *(DWORD*)&X##localClass(); \
#ifdef _AFXDLL
#define BEGIN_INTERFACE_MAP(theClass, theBase) \
const AFX_INTERFACEMAP* PASCAL theClass::_GetBaseInterfaceMap() \
{ return &theBase::interfaceMap; } \
const AFX_INTERFACEMAP* theClass::GetInterfaceMap() const \
{ return &theClass::interfaceMap; } \
AFX_COMDAT const AFX_DATADEF AFX_INTERFACEMAP theClass::interfaceMap = \
{ &theClass::_GetBaseInterfaceMap, &theClass::_interfaceEntries[0], }; \
AFX_COMDAT const AFX_DATADEF AFX_INTERFACEMAP_ENTRY theClass::_interfaceEntries[] = \
{ \
#else
#define BEGIN_INTERFACE_MAP(theClass, theBase) \
const AFX_INTERFACEMAP* theClass::GetInterfaceMap() const \
{ return &theClass::interfaceMap; } \
AFX_COMDAT const AFX_DATADEF AFX_INTERFACEMAP theClass::interfaceMap = \
{ &theBase::interfaceMap, &theClass::_interfaceEntries[0], }; \
AFX_COMDAT const AFX_DATADEF AFX_INTERFACEMAP_ENTRY theClass::_interfaceEntries[] = \
{ \
#endif
#define INTERFACE_PART(theClass, iid, localClass) \
{ &iid, offsetof(theClass, m_x##localClass) }, \
#define INTERFACE_AGGREGATE(theClass, theAggr) \
{ NULL, offsetof(theClass, theAggr) }, \
#define END_INTERFACE_MAP() \
{ NULL, (size_t)-1 } \
}; \
/////////////////////////////////////////////////////////////////////////////
// COleException - unexpected or rare OLE error returned
class COleException : public CException
{
DECLARE_DYNAMIC(COleException)
public:
SCODE m_sc;
static SCODE PASCAL Process(const CException* pAnyException);
// Implementation (use AfxThrowOleException to create)
public:
COleException();
virtual ~COleException();
virtual BOOL GetErrorMessage(LPTSTR lpszError, UINT nMaxError,
PUINT pnHelpContext = NULL);
};
void AFXAPI AfxThrowOleException(SCODE sc);
void AFXAPI AfxCheckError(SCODE sc);
/////////////////////////////////////////////////////////////////////////////
// IDispatch specific exception
class COleDispatchException : public CException
{
DECLARE_DYNAMIC(COleDispatchException)
public:
// Attributes
WORD m_wCode; // error code (specific to IDispatch implementation)
CString m_strDescription; // human readable description of the error
DWORD m_dwHelpContext; // help context for error
// usually empty in application which creates it (eg. servers)
CString m_strHelpFile; // help file to use with m_dwHelpContext
CString m_strSource; // source of the error (name of server)
// Implementation
public:
COleDispatchException(LPCTSTR lpszDescription, UINT nHelpID, WORD wCode);
virtual ~COleDispatchException();
static void PASCAL Process(
EXCEPINFO* pInfo, const CException* pAnyException);
virtual BOOL GetErrorMessage(LPTSTR lpszError, UINT nMaxError,
PUINT pnHelpContext = NULL);
SCODE m_scError; // SCODE describing the error
};
void AFXAPI AfxThrowOleDispatchException(WORD wCode, LPCTSTR lpszDescription,
UINT nHelpID = 0);
void AFXAPI AfxThrowOleDispatchException(WORD wCode, UINT nDescriptionID,
UINT nHelpID = (UINT)-1);
/////////////////////////////////////////////////////////////////////////////
// Macros for CCmdTarget IDispatchable classes
#ifdef _AFXDLL
#define BEGIN_DISPATCH_MAP(theClass, baseClass) \
const AFX_DISPMAP* PASCAL theClass::_GetBaseDispatchMap() \
{ return &baseClass::dispatchMap; } \
const AFX_DISPMAP* theClass::GetDispatchMap() const \
{ return &theClass::dispatchMap; } \
AFX_COMDAT const AFX_DISPMAP theClass::dispatchMap = \
{ &theClass::_GetBaseDispatchMap, &theClass::_dispatchEntries[0], \
&theClass::_dispatchEntryCount, &theClass::_dwStockPropMask }; \
AFX_COMDAT UINT theClass::_dispatchEntryCount = (UINT)-1; \
AFX_COMDAT DWORD theClass::_dwStockPropMask = (DWORD)-1; \
AFX_COMDAT const AFX_DISPMAP_ENTRY theClass::_dispatchEntries[] = \
{ \
#else
#define BEGIN_DISPATCH_MAP(theClass, baseClass) \
const AFX_DISPMAP* theClass::GetDispatchMap() const \
{ return &theClass::dispatchMap; } \
AFX_COMDAT const AFX_DISPMAP theClass::dispatchMap = \
{ &baseClass::dispatchMap, &theClass::_dispatchEntries[0], \
&theClass::_dispatchEntryCount, &theClass::_dwStockPropMask }; \
AFX_COMDAT UINT theClass::_dispatchEntryCount = (UINT)-1; \
AFX_COMDAT DWORD theClass::_dwStockPropMask = (DWORD)-1; \
AFX_COMDAT const AFX_DISPMAP_ENTRY theClass::_dispatchEntries[] = \
{ \
#endif
#define END_DISPATCH_MAP() \
{ VTS_NONE, DISPID_UNKNOWN, VTS_NONE, VT_VOID, \
(AFX_PMSG)NULL, (AFX_PMSG)NULL, (size_t)-1, afxDispCustom } }; \
// parameter types: by value VTs
#define VTS_I2 "\x02" // a 'short'
#define VTS_I4 "\x03" // a 'long'
#define VTS_R4 "\x04" // a 'float'
#define VTS_R8 "\x05" // a 'double'
#define VTS_CY "\x06" // a 'CY' or 'CY*'
#define VTS_DATE "\x07" // a 'DATE'
#define VTS_WBSTR "\x08" // an 'LPCOLESTR'
#define VTS_DISPATCH "\x09" // an 'IDispatch*'
#define VTS_SCODE "\x0A" // an 'SCODE'
#define VTS_BOOL "\x0B" // a 'BOOL'
#define VTS_VARIANT "\x0C" // a 'const VARIANT&' or 'VARIANT*'
#define VTS_UNKNOWN "\x0D" // an 'IUnknown*'
#if defined(_UNICODE) || defined(OLE2ANSI)
#define VTS_BSTR VTS_WBSTR// an 'LPCOLESTR'
#define VT_BSTRT VT_BSTR
#else
#define VTS_BSTR "\x0E" // an 'LPCSTR'
#define VT_BSTRA 14
#define VT_BSTRT VT_BSTRA
#endif
#define VTS_UI1 "\x0F" // a 'BYTE'
// parameter types: by reference VTs
#define VTS_PI2 "\x42" // a 'short*'
#define VTS_PI4 "\x43" // a 'long*'
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -