ExternalCOM.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef NULLSOFT_EXTERNALCOMH
  2. #define NULLSOFT_EXTERNALCOMH
  3. #include <ocidl.h>
  4. #if defined(__cplusplus)
  5. #include <vector>
  6. #include "JSAPI_DispatchTable.h"
  7. #include "IWasabiDispatchable.h"
  8. #include "JSAPI_Info.h"
  9. class SkinCOM;
  10. class MediaCoreCOM;
  11. class CurrentSongCOM;
  12. class ExternalCOM;
  13. class ConfigCOM;
  14. namespace JSAPI2 { class ExternalObject; }
  15. HRESULT __cdecl JSAPI1_GetExternal(ExternalCOM **instance);
  16. HRESULT __cdecl JSAPI1_GetSkinCOM(SkinCOM **instance);
  17. HRESULT __cdecl JSAPI1_GetMediaCoreCOM(MediaCoreCOM **instance);
  18. HRESULT __cdecl JSAPI1_GetCurrentSongCOM(CurrentSongCOM **instance);
  19. class ExternalCOM : public IDispatch,
  20. public IWasabiDispatchable,
  21. public JSAPI::ifc_info
  22. {
  23. public:
  24. enum
  25. {
  26. DISP_EXTERNAL_SIDECAR = 777,
  27. DISP_EXTERNAL_BROWSER,
  28. DISP_EXTERNAL_CURRENTSONG,
  29. DISP_EXTERNAL_CURRENTSKIN,
  30. DISP_EXTERNAL_NEW_ENTRIES_MARKER,
  31. };
  32. public:
  33. ExternalCOM();
  34. ~ExternalCOM();
  35. // *** IUnknown ***
  36. STDMETHOD(QueryInterface)(REFIID riid, PVOID *ppvObject);
  37. STDMETHOD_(ULONG, AddRef)(void);
  38. STDMETHOD_(ULONG, Release)(void);
  39. // *** IDispatch ***
  40. STDMETHOD(GetIDsOfNames)(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid);
  41. STDMETHOD(GetTypeInfo)(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo);
  42. STDMETHOD(GetTypeInfoCount)(unsigned int FAR * pctinfo);
  43. STDMETHOD(Invoke)(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr);
  44. JSAPI::DispatchTable dispatchTable;
  45. DISPID AddDispatch(const wchar_t *name, IDispatch *object);
  46. BOOL RemoveDispatch(DISPID dispatchId);
  47. // *** IWasabiDispatchable Methods ***
  48. STDMETHOD(QueryDispatchable)(REFIID riid, Dispatchable **ppDispatchable);
  49. // *** JSAPI::ifc_info Methods ***
  50. const wchar_t *GetUserAgent();
  51. HRESULT FindDispatch(DISPID dispId, IDispatch **instance);
  52. HRESULT GetSkinCOM(SkinCOM **instance);
  53. HRESULT GetMediaCoreCOM(MediaCoreCOM **instance);
  54. HRESULT GetCurrentSongCOM(CurrentSongCOM **instance);
  55. HRESULT GetConfig(LPCWSTR configName, ConfigCOM **config);
  56. protected:
  57. RECVS_DISPATCH;
  58. private:
  59. typedef std::vector<ConfigCOM*> ConfigsList;
  60. private:
  61. ULONG ref;
  62. CRITICAL_SECTION tableLock;
  63. wchar_t configFilename[MAX_PATH];
  64. MediaCoreCOM *mediaCoreCOM;
  65. SkinCOM *skinCOM;
  66. CurrentSongCOM *songCOM;
  67. JSAPI2::ExternalObject *api2;
  68. ConfigsList configs;
  69. };
  70. #endif // __cplusplus
  71. #endif