1
0

ifc_omservicehost.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef NULLSOFT_WINAMP_OMSERVICE_HOST_INTERFACE_HEADER
  2. #define NULLSOFT_WINAMP_OMSERVICE_HOST_INTERFACE_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <bfc/dispatch.h>
  7. // {75339603-8A3A-490d-84B1-DD493004AAE2}
  8. static const GUID IFC_OmServiceHost =
  9. { 0x75339603, 0x8a3a, 0x490d, { 0x84, 0xb1, 0xdd, 0x49, 0x30, 0x4, 0xaa, 0xe2 } };
  10. interface IDispatch;
  11. class ifc_omservice;
  12. // supports AddRef(), Release(), QueryInterface()
  13. class __declspec(novtable) ifc_omservicehost : public Dispatchable
  14. {
  15. protected:
  16. ifc_omservicehost() {}
  17. ~ifc_omservicehost() {}
  18. public:
  19. HRESULT GetExternal(ifc_omservice *service, IDispatch **ppDispatch); // ppDispatch probably will be already set with JSAPI according to generation
  20. HRESULT GetBasePath(ifc_omservice *service, wchar_t *buffer, unsigned int bufferMax);
  21. HRESULT GetDefaultName(ifc_omservice *service, wchar_t *buffer, unsigned int bufferMax);
  22. HRESULT GetUrl(ifc_omservice *service, wchar_t *buffer, unsigned int bufferMax); // buffer will be set with ifc_omservice->GetUrl() you can modify it if you want. Return: S_OK on success, E_NOTIMPL - if do not care or E_XXX for errror
  23. HRESULT QueryCommandState(ifc_omservice *service, HWND hBrowser, const GUID *commandGroup, UINT commandId);
  24. HRESULT ExecuteCommand(ifc_omservice *service, HWND hBrowser, const GUID *commandGroup, UINT commandId, ULONG_PTR commandArg);
  25. public:
  26. DISPATCH_CODES
  27. {
  28. API_GETEXTERNAL = 10,
  29. API_GETBASEPATH = 20,
  30. API_GETDEFAULTNAME = 30,
  31. API_QUERYCOMMANDSTATE = 40,
  32. API_EXECUTECOMMAND = 50,
  33. API_GETURL = 60,
  34. };
  35. };
  36. inline HRESULT ifc_omservicehost::GetExternal(ifc_omservice *service, IDispatch **ppDispatch)
  37. {
  38. return _call(API_GETEXTERNAL, (HRESULT)E_NOTIMPL, service, ppDispatch);
  39. }
  40. inline HRESULT ifc_omservicehost::GetBasePath(ifc_omservice *service, wchar_t *buffer, unsigned int bufferMax)
  41. {
  42. return _call(API_GETBASEPATH, (HRESULT)E_NOTIMPL, service, buffer, bufferMax);
  43. }
  44. inline HRESULT ifc_omservicehost::GetDefaultName(ifc_omservice *service, wchar_t *buffer, unsigned int bufferMax)
  45. {
  46. return _call(API_GETDEFAULTNAME, (HRESULT)E_NOTIMPL, service, buffer, bufferMax);
  47. }
  48. inline HRESULT ifc_omservicehost::QueryCommandState(ifc_omservice *service, HWND hBrowser, const GUID *commandGroup, UINT commandId)
  49. {
  50. return _call(API_QUERYCOMMANDSTATE, (HRESULT)E_NOTIMPL, service, hBrowser, commandGroup, commandId);
  51. }
  52. inline HRESULT ifc_omservicehost::ExecuteCommand(ifc_omservice *service, HWND hBrowser, const GUID *commandGroup, UINT commandId, ULONG_PTR commandArg)
  53. {
  54. return _call(API_EXECUTECOMMAND, (HRESULT)E_NOTIMPL, service, hBrowser, commandGroup, commandId, commandArg);
  55. }
  56. inline HRESULT ifc_omservicehost::GetUrl(ifc_omservice *service, wchar_t *buffer, unsigned int bufferMax)
  57. {
  58. return _call(API_GETURL, (HRESULT)E_NOTIMPL, service, buffer, bufferMax);
  59. }
  60. #endif //NULLSOFT_WINAMP_OMSERVICE_HOST_INTERFACE_HEADER