When downloading the IDispatchCodeGenerator there's an example included.
This example is processed and generates 3 files.
I'll show you here the results of the generator..
How to use the generated files in your C++ project..
//Take care of the IUnknown: QueryInterface(..), AddRef() and Release()
//HRESULT __stdcall QueryInterface(REFIID riid,void __RPC_FAR *__RPC_FAR *ppvObject) {return QueryInterface(riid,ppvObject);}
//ULONG __stdcall AddRef(){return AddRef();}
//ULONG __stdcall Release(){return Release();}
HRESULT __stdcall GetTypeInfoCount(UINT __RPC_FAR *pctinfo) {
return E_FAIL;
}
HRESULT __stdcall GetTypeInfo(UINT iTInfo,LCID lcid,ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo) {
return E_FAIL;
}
HRESULT __stdcall GetIDsOfNames(REFIID riid,LPOLESTR __RPC_FAR *rgszNames,UINT cNames,LCID lcid,DISPID __RPC_FAR *rgDispId) {
#include "disp1.c"
//Methodname not supported..
*rgDispId = 0;
return E_FAIL;
}
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) {
#include "disp2.c"
return E_FAIL;
}
Generated file disp1.c for IDispatch::GetIDsOfNames(..)
Generated file disp2.c for IDispatch::Invoke(..)
Generated file disp3.c for C++ functions available through IDispatch.