#ifndef __DISPTCH2_H__ #define __DISPTCH2_H__ #include "dispatch.h" #include "asptxn.h" template class ATL_NO_VTABLE CDispatchImpl : public T { public: // IDispatch STDMETHOD(GetTypeInfoCount)(UINT* pctinfo) { *pctinfo = 1; return S_OK; } STDMETHOD(GetTypeInfo)(UINT itinfo, LCID lcid, ITypeInfo** pptinfo) { return gm_tih.GetTypeInfo(itinfo, lcid, pptinfo); } STDMETHOD(GetIDsOfNames)(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid) { return gm_tih.GetIDsOfNames(riid, rgszNames, cNames, lcid, rgdispid); } STDMETHOD(Invoke)(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr) { // VBScript does not distinguish between a propget and a method // implement that behavior for other languages. // if (wFlags & (DISPATCH_METHOD | DISPATCH_PROPERTYGET)) wFlags |= DISPATCH_METHOD | DISPATCH_PROPERTYGET; return gm_tih.Invoke((IDispatch*)this, dispidMember, riid, lcid, wFlags, pdispparams, pvarResult, pexcepinfo, puArgErr); } protected: static CComTypeInfoHolder gm_tih; static HRESULT GetTI(LCID lcid, ITypeInfo** ppInfo) { return gm_tih.GetTI(lcid, ppInfo); } }; typedef CDispatchImpl IApplicationObjectImpl; typedef CDispatchImpl IASPErrorImpl; typedef CDispatchImpl IReadCookieImpl; typedef CDispatchImpl IRequestImpl; typedef CDispatchImpl IRequestDictionaryImpl; typedef CDispatchImpl IResponseImpl; typedef CDispatchImpl IScriptingContextImpl; typedef CDispatchImpl IServerImpl; typedef CDispatchImpl ISessionObjectImpl; typedef CDispatchImpl IStringListImpl; typedef CDispatchImpl IVariantDictionaryImpl; typedef CDispatchImpl IWriteCookieImpl; typedef CDispatchImpl IASPObjectContextImpl; #endif // __DISPTCH2_H__