- 浏览: 408874 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
wcjagta:
...
dedecms插件开发教程 -
xc2013:
看起来不错 先下载来试试
ECSHOP完全静态化解决方法 -
greemranqq:
你好,我在xp 上做实验,也是JS css带不过来,关于 ro ...
nginx资源定向 css js路径问题 -
hotsmile:
表结构给出来吧,测试的提示说要注册,
中国移动CMPP短信开发平台通讯包 2.8 -
mengdejun:
gang80306176 写道这个插件怎么用和安装普通插件一样 ...
phpcms2008 sp4单网页编辑器插件
AbstractDispatch.idl
import "unknwn.idl"; import "oaidl.idl"; coclass CAbstractDispatch; interface IAbstractDispatch; [ // {35EE0AE4-D79B-4d50-8532-F27911171EC5} //static const GUID <<name>> = { 0x35ee0ae4, 0xd79b, 0x4d50, { 0x85, 0x32, 0xf2, 0x79, 0x11, 0x17, 0x1e, 0xc5 } }; object, uuid(35EE0AE4-D79B-4d50-8532-F27911171EC5), pointer_default(unique), dual, oleautomation ] interface IAbstractDispatch:IDispatch { [id(1), helpstring("初始化")]HRESULT Init(); [id(2), helpstring("释放资源")]HRESULT Destory(); }; [ // {7D969C16-F84C-45e8-9922-CC0C41E351BC} //static const GUID <<name>> = {0x7d969c16, 0xf84c, 0x45e8, { 0x99, 0x22, 0xcc, 0xc, 0x41, 0xe3, 0x51, 0xbc } }; uuid(7D969C16-F84C-45e8-9922-CC0C41E351BC), version(1.0) ] library AbstractDispatchLib { importlib("stdole2.tlb"); // {64DCAD3D-B39C-4b96-902D-8059336C3410} //static const GUID <<name>> = { 0x64dcad3d, 0xb39c, 0x4b96, { 0x90, 0x2d, 0x80, 0x59, 0x33, 0x6c, 0x34, 0x10 } }; [ uuid(64DCAD3D-B39C-4b96-902D-8059336C3410) ] coclass CAbstractDispatch { [default]interface IAbstractDispatch; }; };
CCOMIDispatchImpl.h
#ifndef __unknwn_h__ #include <objbase.h> #include <unknwn.h> #endif class CCOMIDispatchImpl:public IDispatch { public: CCOMIDispatchImpl(REFGUID rgUid,REFGUID clsUid,OLECHAR* file) { Init(rgUid,clsUid,file); } virtual HRESULT _stdcall Init(REFGUID rgUid,REFGUID clsUid,OLECHAR* file) { HRESULT hr=NULL; ITypeLib* t_t=NULL; if(m_pi==NULL) { hr=LoadRegTypeLib(rgUid,1,0,0x00,&t_t); if(FAILED(hr)) { return hr; } hr=LoadTypeLib(file,&t_t); if(FAILED(hr)) { return hr; } hr=RegisterTypeLib(t_t,file,NULL); if(FAILED(hr)) { return hr; } HRESULT hr=t_t->GetTypeInfoOfGuid(clsUid,&m_pi); t_t->Release(); if(FAILED(hr)) { return hr; } } return S_OK; } virtual HRESULT _stdcall QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject) { return S_OK; } virtual ULONG _stdcall AddRef() { return InterlockedIncrement(&m_comRef); } virtual ULONG _stdcall Release() { if(InterlockedDecrement(&m_comRef)==0) { delete this; return 0; } return m_comRef; } virtual HRESULT _stdcall GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo) { *ppTInfo=NULL; if(iTInfo!=0) { return DISP_E_BADINDEX; } m_pi->AddRef(); *ppTInfo=m_pi; return S_OK; } virtual HRESULT _stdcall GetTypeInfoCount(UINT __RPC_FAR *pctinfo) { *pctinfo=1; return S_OK; } virtual HRESULT _stdcall GetIDsOfNames(REFIID riid, LPOLESTR __RPC_FAR *rgszNames, UINT cNames, LCID lcid, DISPID __RPC_FAR *rgDispId) { if(riid!=IID_NULL) { return DISP_E_UNKNOWNINTERFACE; } HRESULT hr=m_pi->GetIDsOfNames(rgszNames,cNames,rgDispId); return hr; } virtual HRESULT _stdcall Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS __RPC_FAR *pDispParams, VARIANT __RPC_FAR *pVarResult, EXCEPINFO __RPC_FAR *pExcepInfo, UINT __RPC_FAR *puArgErr) { if(riid!=IID_NULL) { return DISP_E_UNKNOWNINTERFACE; } SetErrorInfo(0,NULL); HRESULT hr=m_pi->Invoke(static_cast<IDispatch*>(this),dispIdMember,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr); return hr; } protected: long m_comRef; ITypeInfo* m_pi; };
AbstractDispatch.h
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 5.01.0164 */ /* at Sun Jan 03 20:26:24 2010 */ /* Compiler settings for AbstractDispatch.idl: Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext error checks: allocation ref bounds_check enum stub_data */ //@@MIDL_FILE_HEADING( ) /* verify that the <rpcndr.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 440 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of <rpcndr.h> #endif // __RPCNDR_H_VERSION__ #ifndef COM_NO_WINDOWS_H #include "windows.h" #include "ole2.h" #endif /*COM_NO_WINDOWS_H*/ #ifndef __AbstractDispatch_h__ #define __AbstractDispatch_h__ #ifdef __cplusplus extern "C"{ #endif /* Forward Declarations */ #ifndef __IAbstractDispatch_FWD_DEFINED__ #define __IAbstractDispatch_FWD_DEFINED__ typedef interface IAbstractDispatch IAbstractDispatch; #endif /* __IAbstractDispatch_FWD_DEFINED__ */ #ifndef __CAbstractDispatch_FWD_DEFINED__ #define __CAbstractDispatch_FWD_DEFINED__ #ifdef __cplusplus typedef class CAbstractDispatch CAbstractDispatch; #else typedef struct CAbstractDispatch CAbstractDispatch; #endif /* __cplusplus */ #endif /* __CAbstractDispatch_FWD_DEFINED__ */ /* header files for imported files */ #include "unknwn.h" #include "oaidl.h" void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); void __RPC_USER MIDL_user_free( void __RPC_FAR * ); /* interface __MIDL_itf_AbstractDispatch_0000 */ /* [local] */ extern RPC_IF_HANDLE __MIDL_itf_AbstractDispatch_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_AbstractDispatch_0000_v0_0_s_ifspec; #ifndef __IAbstractDispatch_INTERFACE_DEFINED__ #define __IAbstractDispatch_INTERFACE_DEFINED__ /* interface IAbstractDispatch */ /* [oleautomation][dual][unique][uuid][object] */ EXTERN_C const IID IID_IAbstractDispatch; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("35EE0AE4-D79B-4d50-8532-F27911171EC5") IAbstractDispatch : public IDispatch { public: virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Init( void) = 0; virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Destory( void) = 0; }; #else /* C style interface */ typedef struct IAbstractDispatchVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( IAbstractDispatch __RPC_FAR * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( IAbstractDispatch __RPC_FAR * This); ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( IAbstractDispatch __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( IAbstractDispatch __RPC_FAR * This, /* [out] */ UINT __RPC_FAR *pctinfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( IAbstractDispatch __RPC_FAR * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( IAbstractDispatch __RPC_FAR * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( IAbstractDispatch __RPC_FAR * This, /* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr); /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Init )( IAbstractDispatch __RPC_FAR * This); /* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Destory )( IAbstractDispatch __RPC_FAR * This); END_INTERFACE } IAbstractDispatchVtbl; interface IAbstractDispatch { CONST_VTBL struct IAbstractDispatchVtbl __RPC_FAR *lpVtbl; }; #ifdef COBJMACROS #define IAbstractDispatch_QueryInterface(This,riid,ppvObject) \ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) #define IAbstractDispatch_AddRef(This) \ (This)->lpVtbl -> AddRef(This) #define IAbstractDispatch_Release(This) \ (This)->lpVtbl -> Release(This) #define IAbstractDispatch_GetTypeInfoCount(This,pctinfo) \ (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) #define IAbstractDispatch_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) #define IAbstractDispatch_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) #define IAbstractDispatch_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) #define IAbstractDispatch_Init(This) \ (This)->lpVtbl -> Init(This) #define IAbstractDispatch_Destory(This) \ (This)->lpVtbl -> Destory(This) #endif /* COBJMACROS */ #endif /* C style interface */ /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IAbstractDispatch_Init_Proxy( IAbstractDispatch __RPC_FAR * This); void __RPC_STUB IAbstractDispatch_Init_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IAbstractDispatch_Destory_Proxy( IAbstractDispatch __RPC_FAR * This); void __RPC_STUB IAbstractDispatch_Destory_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); #endif /* __IAbstractDispatch_INTERFACE_DEFINED__ */ #ifndef __AbstractDispatchLib_LIBRARY_DEFINED__ #define __AbstractDispatchLib_LIBRARY_DEFINED__ /* library AbstractDispatchLib */ /* [uuid] */ EXTERN_C const IID LIBID_AbstractDispatchLib; EXTERN_C const CLSID CLSID_CAbstractDispatch; #ifdef __cplusplus class DECLSPEC_UUID("64DCAD3D-B39C-4b96-902D-8059336C3410") CAbstractDispatch; #endif #endif /* __AbstractDispatchLib_LIBRARY_DEFINED__ */ /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif
AbstractDispatch_i.c
/* this file contains the actual definitions of */ /* the IIDs and CLSIDs */ /* link this file in with the server and any clients */ /* File created by MIDL compiler version 5.01.0164 */ /* at Sun Jan 03 20:26:24 2010 */ /* Compiler settings for AbstractDispatch.idl: Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext error checks: allocation ref bounds_check enum stub_data */ //@@MIDL_FILE_HEADING( ) #ifdef __cplusplus extern "C"{ #endif #ifndef __IID_DEFINED__ #define __IID_DEFINED__ typedef struct _IID { unsigned long x; unsigned short s1; unsigned short s2; unsigned char c[8]; } IID; #endif // __IID_DEFINED__ #ifndef CLSID_DEFINED #define CLSID_DEFINED typedef IID CLSID; #endif // CLSID_DEFINED const IID IID_IAbstractDispatch = {0x35EE0AE4,0xD79B,0x4d50,{0x85,0x32,0xF2,0x79,0x11,0x17,0x1E,0xC5}}; const IID LIBID_AbstractDispatchLib = {0x7D969C16,0xF84C,0x45e8,{0x99,0x22,0xCC,0x0C,0x41,0xE3,0x51,0xBC}}; const CLSID CLSID_CAbstractDispatch = {0x64DCAD3D,0xB39C,0x4b96,{0x90,0x2D,0x80,0x59,0x33,0x6C,0x34,0x10}}; #ifdef __cplusplus } #endif
AbstractDispatch_p.c/* this ALWAYS GENERATED file contains the proxy stub code */ /* File created by MIDL compiler version 5.01.0164 */ /* at Sun Jan 03 20:26:24 2010 */ /* Compiler settings for AbstractDispatch.idl: Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext error checks: allocation ref bounds_check enum stub_data */ //@@MIDL_FILE_HEADING( ) /* verify that the <rpcproxy.h> version is high enough to compile this file*/ #ifndef __REDQ_RPCPROXY_H_VERSION__ #define __REQUIRED_RPCPROXY_H_VERSION__ 440 #endif #include "rpcproxy.h" #ifndef __RPCPROXY_H_VERSION__ #error this stub requires an updated version of <rpcproxy.h> #endif // __RPCPROXY_H_VERSION__ #include "AbstractDispatch.h" #define TYPE_FORMAT_STRING_SIZE 3 #define PROC_FORMAT_STRING_SIZE 3 typedef struct _MIDL_TYPE_FORMAT_STRING { short Pad; unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; } MIDL_TYPE_FORMAT_STRING; typedef struct _MIDL_PROC_FORMAT_STRING { short Pad; unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; } MIDL_PROC_FORMAT_STRING; extern const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString; extern const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString; /* Standard interface: __MIDL_itf_AbstractDispatch_0000, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} */ /* Object interface: IUnknown, ver. 0.0, GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ /* Object interface: IDispatch, ver. 0.0, GUID={0x00020400,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */ /* Object interface: IAbstractDispatch, ver. 0.0, GUID={0x35EE0AE4,0xD79B,0x4d50,{0x85,0x32,0xF2,0x79,0x11,0x17,0x1E,0xC5}} */ extern const MIDL_STUB_DESC Object_StubDesc; #pragma code_seg(".orpc") /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IAbstractDispatch_Init_Proxy( IAbstractDispatch __RPC_FAR * This) { HRESULT _RetVal; RPC_MESSAGE _RpcMessage; MIDL_STUB_MESSAGE _StubMsg; RpcTryExcept { NdrProxyInitialize( ( void __RPC_FAR * )This, ( PRPC_MESSAGE )&_RpcMessage, ( PMIDL_STUB_MESSAGE )&_StubMsg, ( PMIDL_STUB_DESC )&Object_StubDesc, 7); RpcTryFinally { _StubMsg.BufferLength = 0U; NdrProxyGetBuffer(This, &_StubMsg); NdrProxySendReceive(This, &_StubMsg); if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION ) NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] ); _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++; } RpcFinally { NdrProxyFreeBuffer(This, &_StubMsg); } RpcEndFinally } RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE) { _RetVal = NdrProxyErrorHandler(RpcExceptionCode()); } RpcEndExcept return _RetVal; } void __RPC_STUB IAbstractDispatch_Init_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase) { HRESULT _RetVal; MIDL_STUB_MESSAGE _StubMsg; NdrStubInitialize( _pRpcMessage, &_StubMsg, &Object_StubDesc, _pRpcChannelBuffer); RpcTryFinally { *_pdwStubPhase = STUB_CALL_SERVER; _RetVal = (((IAbstractDispatch*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> Init((IAbstractDispatch *) ((CStdStubBuffer *)This)->pvServerObject); *_pdwStubPhase = STUB_MARSHAL; _StubMsg.BufferLength = 4U; NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg); *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal; } RpcFinally { } RpcEndFinally _pRpcMessage->BufferLength = (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer); } /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IAbstractDispatch_Destory_Proxy( IAbstractDispatch __RPC_FAR * This) { HRESULT _RetVal; RPC_MESSAGE _RpcMessage; MIDL_STUB_MESSAGE _StubMsg; RpcTryExcept { NdrProxyInitialize( ( void __RPC_FAR * )This, ( PRPC_MESSAGE )&_RpcMessage, ( PMIDL_STUB_MESSAGE )&_StubMsg, ( PMIDL_STUB_DESC )&Object_StubDesc, 8); RpcTryFinally { _StubMsg.BufferLength = 0U; NdrProxyGetBuffer(This, &_StubMsg); NdrProxySendReceive(This, &_StubMsg); if ( (_RpcMessage.DataRepresentation & 0X0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION ) NdrConvert( (PMIDL_STUB_MESSAGE) &_StubMsg, (PFORMAT_STRING) &__MIDL_ProcFormatString.Format[0] ); _RetVal = *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++; } RpcFinally { NdrProxyFreeBuffer(This, &_StubMsg); } RpcEndFinally } RpcExcept(_StubMsg.dwStubPhase != PROXY_SENDRECEIVE) { _RetVal = NdrProxyErrorHandler(RpcExceptionCode()); } RpcEndExcept return _RetVal; } void __RPC_STUB IAbstractDispatch_Destory_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase) { HRESULT _RetVal; MIDL_STUB_MESSAGE _StubMsg; NdrStubInitialize( _pRpcMessage, &_StubMsg, &Object_StubDesc, _pRpcChannelBuffer); RpcTryFinally { *_pdwStubPhase = STUB_CALL_SERVER; _RetVal = (((IAbstractDispatch*) ((CStdStubBuffer *)This)->pvServerObject)->lpVtbl) -> Destory((IAbstractDispatch *) ((CStdStubBuffer *)This)->pvServerObject); *_pdwStubPhase = STUB_MARSHAL; _StubMsg.BufferLength = 4U; NdrStubGetBuffer(This, _pRpcChannelBuffer, &_StubMsg); *(( HRESULT __RPC_FAR * )_StubMsg.Buffer)++ = _RetVal; } RpcFinally { } RpcEndFinally _pRpcMessage->BufferLength = (unsigned int)((long)_StubMsg.Buffer - (long)_pRpcMessage->Buffer); } static const MIDL_STUB_DESC Object_StubDesc = { 0, NdrOleAllocate, NdrOleFree, 0, 0, 0, 0, 0, __MIDL_TypeFormatString.Format, 1, /* -error bounds_check flag */ 0x10001, /* Ndr library version */ 0, 0x50100a4, /* MIDL Version 5.1.164 */ 0, 0, 0, /* notify & notify_flag routine table */ 1, /* Flags */ 0, /* Reserved3 */ 0, /* Reserved4 */ 0 /* Reserved5 */ }; CINTERFACE_PROXY_VTABLE(9) _IAbstractDispatchProxyVtbl = { &IID_IAbstractDispatch, IUnknown_QueryInterface_Proxy, IUnknown_AddRef_Proxy, IUnknown_Release_Proxy , 0 /* IDispatch_GetTypeInfoCount_Proxy */ , 0 /* IDispatch_GetTypeInfo_Proxy */ , 0 /* IDispatch_GetIDsOfNames_Proxy */ , 0 /* IDispatch_Invoke_Proxy */ , IAbstractDispatch_Init_Proxy , IAbstractDispatch_Destory_Proxy }; static const PRPC_STUB_FUNCTION IAbstractDispatch_table[] = { STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, STUB_FORWARDING_FUNCTION, IAbstractDispatch_Init_Stub, IAbstractDispatch_Destory_Stub }; CInterfaceStubVtbl _IAbstractDispatchStubVtbl = { &IID_IAbstractDispatch, 0, 9, &IAbstractDispatch_table[-3], CStdStubBuffer_DELEGATING_METHODS }; #pragma data_seg(".rdata") #if !defined(__RPC_WIN32__) #error Invalid build platform for this stub. #endif static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString = { 0, { 0x53, /* FC_RETURN_PARAM_BASETYPE */ 0x8, /* FC_LONG */ 0x0 } }; static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString = { 0, { NdrFcShort( 0x0 ), /* 0 */ 0x0 } }; const CInterfaceProxyVtbl * _AbstractDispatch_ProxyVtblList[] = { ( CInterfaceProxyVtbl *) &_IAbstractDispatchProxyVtbl, 0 }; const CInterfaceStubVtbl * _AbstractDispatch_StubVtblList[] = { ( CInterfaceStubVtbl *) &_IAbstractDispatchStubVtbl, 0 }; PCInterfaceName const _AbstractDispatch_InterfaceNamesList[] = { "IAbstractDispatch", 0 }; const IID * _AbstractDispatch_BaseIIDList[] = { &IID_IDispatch, 0 }; #define _AbstractDispatch_CHECK_IID(n) IID_GENERIC_CHECK_IID( _AbstractDispatch, pIID, n) int __stdcall _AbstractDispatch_IID_Lookup( const IID * pIID, int * pIndex ) { if(!_AbstractDispatch_CHECK_IID(0)) { *pIndex = 0; return 1; } return 0; } const ExtendedProxyFileInfo AbstractDispatch_ProxyFileInfo = { (PCInterfaceProxyVtblList *) & _AbstractDispatch_ProxyVtblList, (PCInterfaceStubVtblList *) & _AbstractDispatch_StubVtblList, (const PCInterfaceName * ) & _AbstractDispatch_InterfaceNamesList, (const IID ** ) & _AbstractDispatch_BaseIIDList, & _AbstractDispatch_IID_Lookup, 1, 1, 0, /* table of [async_uuid] interfaces */ 0, /* Filler1 */ 0, /* Filler2 */ 0 /* Filler3 */ };
CAbstractDispatch.h
#include "AbstractDispatch.h" class CAbstractDispatch:public IAbstractDispatch { public: CAbstractDispatch(); CAbstractDispatch(ITypeInfo* m_p); virtual HRESULT _stdcall Init(); virtual HRESULT _stdcall Destory(); virtual ULONG _stdcall AddRef(); virtual ULONG _stdcall Release(); virtual HRESULT _stdcall QueryInterface(const IID& riid,void** ppvObject)=0; /************************************************************************/ /* 读取一个函数名称,返回调度ID DISPID长整数索引(函数指针数组),由自动化化控制程序调用invoke /************************************************************************/ virtual HRESULT _stdcall GetIDsOfNames(REFIID riid, LPOLESTR __RPC_FAR *rgszNames, UINT cNames, LCID lcid, DISPID __RPC_FAR *rgDispId); /************************************************************************/ /* /************************************************************************/ virtual HRESULT _stdcall GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); /************************************************************************/ /* 自动化组件支持接口的数目 ITypeInfo /************************************************************************/ virtual HRESULT _stdcall GetTypeInfoCount(UINT __RPC_FAR *pctinfo); virtual HRESULT _stdcall Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS __RPC_FAR *pDispParams, VARIANT __RPC_FAR *pVarResult, EXCEPINFO __RPC_FAR *pExcepInfo, UINT __RPC_FAR *puArgErr); protected: ITypeInfo* m_pITtypeInfo; long m_ref; }; const CLSID CLS_CABSTRACTDISPATCH = { 0x64dcad3d, 0xb39c, 0x4b96, { 0x90, 0x2d, 0x80, 0x59, 0x33, 0x6c, 0x34, 0x10 } };
CAbstractDispatch.cpp
#include "CAbstractDispatch.h" //#include "CCOMIDispatchImpl.h" //extern GUID LIBID_SERVER; //extern IID IID_IX; CAbstractDispatch::CAbstractDispatch() { m_ref=0; m_pITtypeInfo=NULL; Init(); } CAbstractDispatch::CAbstractDispatch(ITypeInfo* m_p) { m_pITtypeInfo=m_p; } HRESULT _stdcall CAbstractDispatch::Destory() { return S_OK; } HRESULT _stdcall CAbstractDispatch::Init() { /** HRESULT hr; if(m_pITtypeInfo==NULL) { ITypeLib* pITypeLib=NULL; hr=LoadRegTypeLib(LIBID_SERVER,1.0,0x00,NULL,&pITypeLib); if(FAILED(hr)) { hr=LoadTypeLib(L"Server.lib",&pITypeLib); if(FAILED(hr)) { return hr; } hr=RegisterTypeLib(pITypeLib,L"Server.tlb",NULL); if (FAILED(hr)) { return hr; } } hr=pITypeLib->GetTypeInfoOfGuid(IID_IX,&m_pITtypeInfo); pITypeLib->Release(); if(FAILED(hr)) { return hr; } } */ return S_OK; } /** HRESULT _stdcall CAbstractDispatch::QueryInterface(const IID& riid,void** ppvObject) { return S_OK; } */ ULONG _stdcall CAbstractDispatch::AddRef() { return InterlockedIncrement(&m_ref); } ULONG _stdcall CAbstractDispatch::Release() { if(InterlockedDecrement(&m_ref)==0) { delete this; return 0; } return m_ref; } HRESULT _stdcall CAbstractDispatch::GetIDsOfNames(REFIID riid, LPOLESTR __RPC_FAR *rgszNames, UINT cNames, LCID lcid, DISPID __RPC_FAR *rgDispId) { if(riid!=IID_NULL) { return DISP_E_UNKNOWNINTERFACE; } HRESULT hr=m_pITtypeInfo->GetIDsOfNames(rgszNames,cNames,rgDispId); return hr; } HRESULT _stdcall CAbstractDispatch::GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo) { *ppTInfo=NULL; if(iTInfo!=0) { return DISP_E_BADINDEX; } m_pITtypeInfo->AddRef(); *ppTInfo=m_pITtypeInfo; return S_OK; } HRESULT _stdcall CAbstractDispatch::GetTypeInfoCount(UINT __RPC_FAR *pctinfo) { *pctinfo=1; return S_OK; } HRESULT _stdcall CAbstractDispatch::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS __RPC_FAR *pDispParams, VARIANT __RPC_FAR *pVarResult, EXCEPINFO __RPC_FAR *pExcepInfo, UINT __RPC_FAR *puArgErr) { if(riid!=IID_NULL) { return DISP_E_UNKNOWNINTERFACE; } SetErrorInfo(0,NULL); HRESULT hr=m_pITtypeInfo->Invoke(static_cast<IDispatch*>(this),dispIdMember,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr); return hr; }
dlldata.c
/********************************************************* DllData file -- generated by MIDL compiler DO NOT ALTER THIS FILE This file is regenerated by MIDL on every IDL file compile. To completely reconstruct this file, delete it and rerun MIDL on all the IDL files in this DLL, specifying this file for the /dlldata command line option *********************************************************/ #define PROXY_DELEGATION #include <rpcproxy.h> #ifdef __cplusplus extern "C" { #endif EXTERN_PROXY_FILE( AbstractDispatch ) PROXYFILE_LIST_START /* Start of list */ REFERENCE_PROXY_FILE( AbstractDispatch ), /* End of list */ PROXYFILE_LIST_END DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID ) #ifdef __cplusplus } /*extern "C" */ #endif /* end of generated dlldata file */
- IDispatch.rar (16.9 KB)
- 下载次数: 9
发表评论
-
COM 包容与聚合
2011-02-26 18:56 1350COM不支持实现继承的原 ... -
COM 嵌套类实现COM
2011-02-26 18:54 1055Ia.h //#include <objbase.h& ... -
COM 智能指针CComPtr
2011-02-26 18:48 1985template <class T> class ... -
COM IClassFactory接口封装
2011-02-26 18:35 1403CAbstractClassFactory.h #inclu ... -
COM IUnknown接口封装(非代理)
2011-02-26 18:33 1686CNonDelegatingUnknown.h #ifnde ... -
COM IUnknown接口封装
2011-02-26 18:32 1187CAbstractUnknown.h #include &l ... -
COM组件
2010-11-21 14:57 1020COM组件 COM component(C ...
相关推荐
通用IDispatch接口是COM(Component Object Model)组件模型中的一个重要接口,主要用于支持晚绑定(late binding)和自动化(automation)。这个接口使得不熟悉组件具体类型的客户端代码能够动态地调用组件的方法和...
MFC提供了COleDispatchDriver类,该类封装了IDispatch接口的实现,使得创建自动化服务器变得更加简单。 总的来说,IDispatch接口是COM组件设计的关键部分,特别是在涉及到自动化和脚本语言支持的场景下。通过这个...
IDispatch接口主要用于动态访问对象的方法和属性,它对于那些在编译时不知道具体类型或方法的程序尤其有用。这个接口提供了两种主要方法:`GetIDsOfNames`和`Invoke`。`GetIDsOfNames`用于将方法或属性的名称映射到...
1. **MFC与COM集成**:MFC提供了对COM的支持,包括封装IDispatch接口。`COleDispatchDriver`类是MFC提供的一个基类,用于处理LPDISPATCH属性,它简化了与自动化服务器的交互。 2. **COleDispatchDriver的使用**:这...
通过实现IDispatch接口,ATL对象可以接收并响应来自JavaScript的事件,实现两者之间的双向通信。 3. 学习COM的绝佳案例:ATL浏览器项目是理解COM编程的一个好例子。它涉及到COM对象的创建、接口定义、IUnknown的...
IDispatch接口在“COM 组件设计与应用(十)——IDispatch 接口 for VC_NET - VC知识库文章.mht”和“COM 组件设计与应用(九)——IDispatch 接口 for VC6_0 - VC知识库文章.mht”中被详细解析,这部分内容主要探讨...
这通常涉及对COM接口的理解、IDispatch接口的调用以及类型库的解析。 2. **COM组件理解** COM组件是二进制可执行代码,它们提供了一组接口,这些接口定义了组件可以执行的操作。每个接口包含一组方法和属性,通过...
双接口是指同时实现IUnknown和IDispatch接口的组件,提供标准和动态调用方式。 6. **错误与异常处理** (VC知识库文章 - COM组件设计与应用(十二)——错误与异常处理.htm):在COM编程中,错误通常通过返回值或接口...
IDispatch接口提供了动态调用方法和属性访问的能力,而IUnknown接口是所有COM接口的基础,提供了对象的引用计数和接口查询功能。 2. **接口定义语言(IDL)**:IDL是一种用于描述COM接口的规范性语言。在VC++中,...
在"COM组件设计与应用10——IDispatch 接口 for VC_NET"和"COM 组件设计与应用9——IDispatch 接口 for VC6_0"中,IDispatch接口被重点介绍。它是COM中用于自动化和动态类型发现的关键接口,允许不熟悉组件内部细节...
1. 在接口中声明IDispatch接口或者自定义接口。 2. 使用`RegisterComServer`宏注册COM服务器。 3. 在客户端,使用`CoCreateInstance`创建对象实例,并通过`QueryInterface`获取接口指针。 总的来说,Delphi中的DLL...
4. **双重接口**: 双重接口结合了接口指针(IUnknown)和IDispatch接口,允许晚绑定和自动化。IDispatch接口提供了对对象属性和方法的访问,支持VBA等脚本语言。 5. **Aggregation**: 集成是COM中一种特殊形式的...
同时,由于DLL和调用程序可能不在同一个进程空间,所以通常会使用接口(如IUnknown、IDispatch等)进行通信,以支持跨进程调用。 下面是一个简单的调用DLL中对象的示例: ```delphi uses ComObj; var ...
4. **IDispatch接口**:在COM中,IDispatch接口用于支持动态类型,允许在运行时获取和调用对象的方法和属性。易语言源码可能包含了如何使用和实现IDispatch接口的示例。 5. **注册和使用COM组件**:在易语言中,...
WebBrowser控件会将宿主对象暴露为IDispatch接口,JS可以通过这个接口调用宿主对象的成员方法和属性。首先,你需要在C++中定义一个支持IDispatch的COM对象,然后将这个对象注册为WebBrowser的导航完成事件处理函数中...
3. **接口和继承**:介绍IDispatch接口用于晚绑定,以及IUnknown和IDispatch接口在COM中的角色。同时可能涉及接口的多继承和纯虚函数。 4. **COM类工厂**:讲解类工厂(Class Factory)的概念,它是创建COM组件实例...
这通常通过CoInitialize和CoCreateInstance函数完成,后者用于实例化Excel的IDispatch接口。 3. **创建工作簿**:使用Application对象的Workbooks成员创建新的Excel工作簿,调用Add方法即可。例如:`m_excelApp....
2. **创建PowerPoint对象**: 使用CoCreateInstance函数创建一个PowerPoint应用对象,通过IID_IDispatch接口与之交互。 3. **打开PPT文件**: 调用PowerPoint对象的Open方法,传入PPT文件路径,打开文件。 4. **遍历...
7. **IDispatch接口**:对于不支持接口继承的语言,如VB,可以通过IDispatch接口来访问COM对象的方法和属性,实现晚绑定。 8. **自动化(Automation)**:COM自动化使得简单类型的接口可以被VB、Excel等工具直接...