1
0

JSAPI2_ExternalObject.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include <ocidl.h>
  3. #include "JSAPI_DispatchTable.h"
  4. #include "../nu/ConfigCOM.h"
  5. #include "IWasabiDispatchable.h"
  6. #include "JSAPI_Info.h"
  7. #include <dispex.h>
  8. namespace JSAPI2
  9. {
  10. class ExternalObject : public IDispatchEx,
  11. public IWasabiDispatchable,
  12. public JSAPI::ifc_info
  13. {
  14. public:
  15. ExternalObject(const wchar_t *_key);
  16. ~ExternalObject();
  17. // *** IUnknown Methods ***
  18. STDMETHOD(QueryInterface)(REFIID riid, PVOID *ppvObject);
  19. STDMETHOD_(ULONG, AddRef)(void);
  20. STDMETHOD_(ULONG, Release)(void);
  21. private:
  22. // *** IDispatch Methods ***
  23. STDMETHOD(GetIDsOfNames)(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid);
  24. STDMETHOD(GetTypeInfo)(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo);
  25. STDMETHOD(GetTypeInfoCount)(unsigned int FAR * pctinfo);
  26. STDMETHOD(Invoke)(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr);
  27. // *** IDispatchEx Methods ***
  28. STDMETHOD (GetDispID)(BSTR bstrName, DWORD grfdex, DISPID *pid);
  29. STDMETHOD (InvokeEx)(DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller);
  30. STDMETHOD (DeleteMemberByName)(BSTR bstrName, DWORD grfdex) ;
  31. STDMETHOD (DeleteMemberByDispID)(DISPID id);
  32. STDMETHOD (GetMemberProperties)(DISPID id, DWORD grfdexFetch, DWORD *pgrfdex);
  33. STDMETHOD (GetMemberName)(DISPID id, BSTR *pbstrName);
  34. STDMETHOD (GetNextDispID)(DWORD grfdex, DISPID id, DISPID *pid);
  35. STDMETHOD (GetNameSpaceParent)(IUnknown **ppunk);
  36. // *** IWasabiDispatchable Methods ***
  37. STDMETHOD(QueryDispatchable)(REFIID riid, Dispatchable **ppDispatchable);
  38. // *** JSAPI::ifc_info Methods ***
  39. const wchar_t *GetUserAgent();
  40. void SetHWND(HWND hwnd);
  41. HWND GetHWND();
  42. void SetName(const wchar_t *name);
  43. const wchar_t *GetName();
  44. int AddAPI(const wchar_t *name, IDispatch *dispatch);
  45. private:
  46. // private helper methods
  47. DWORD AddDispatch(const wchar_t *name, IDispatch *object);
  48. // members
  49. JSAPI::DispatchTable dispatchTable;
  50. volatile LONG refCount;
  51. wchar_t *key;
  52. HWND hwnd;
  53. protected:
  54. RECVS_DISPATCH;
  55. };
  56. }