1
0

service.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef NULLSOFT_PODCAST_PLUGIN_SERVICE_HEADER
  2. #define NULLSOFT_PODCAST_PLUGIN_SERVICE_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <wtypes.h>
  7. #include <atomic>
  8. #include "../omBrowser/ifc_omservice.h"
  9. class OmService;
  10. typedef HWND (CALLBACK *SVCWNDCREATEPROC)(HWND /*hParent*/, OmService* /*service*/);
  11. class OmService : public ifc_omservice
  12. {
  13. public:
  14. typedef enum
  15. {
  16. flagRoot = 0x00000001,
  17. flagLocal = 0x00000002,
  18. } Flags;
  19. protected:
  20. OmService( UINT nId );
  21. ~OmService();
  22. public:
  23. static HRESULT CreateRemote( UINT nId, LPCWSTR pszName, LPCWSTR pszIcon, LPCWSTR pszUrl, OmService **instance );
  24. static HRESULT CreateLocal( UINT nId, LPCWSTR pszName, LPCWSTR pszIcon, SVCWNDCREATEPROC windowCreator, OmService **instance );
  25. /* Dispatchable */
  26. size_t AddRef();
  27. size_t Release();
  28. int QueryInterface( GUID interface_guid, void **object );
  29. /* ifc_omservice */
  30. unsigned int GetId();
  31. HRESULT GetName( wchar_t *pszBuffer, int cchBufferMax );
  32. HRESULT GetUrl( wchar_t *pszBuffer, int cchBufferMax );
  33. HRESULT GetExternal( IDispatch **ppDispatch );
  34. HRESULT GetIcon( wchar_t *pszBuffer, int cchBufferMax );
  35. HRESULT SetName( LPCWSTR pszName );
  36. HRESULT SetUrl( LPCWSTR pszUrl );
  37. HRESULT SetIcon( LPCWSTR pszIcon );
  38. void SetFlags( UINT mask, UINT newFlags );
  39. UINT GetFlags( void );
  40. HRESULT SetWindowCreator( SVCWNDCREATEPROC proc );
  41. HRESULT GetWindowCreator( SVCWNDCREATEPROC *proc );
  42. HRESULT CreateView( HWND hParent, HWND *hView );
  43. protected:
  44. RECVS_DISPATCH;
  45. std::atomic<std::size_t> _ref = 1;
  46. UINT id = 0;
  47. LPWSTR name = NULL;
  48. LPWSTR url = NULL;
  49. SVCWNDCREATEPROC windowCreator = NULL;
  50. LPWSTR icon = NULL;
  51. UINT flags = 0;
  52. };
  53. #endif //NULLSOFT_PODCAST_PLUGIN_SERVICE_HEADER