Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

231 lines
4.8 KiB

  1. #include "priv.h"
  2. #include "zaxxon.h"
  3. #include "guids.h"
  4. #include "shlwapip.h"
  5. #include "mmreg.h"
  6. #include "mmstream.h" // Multimedia stream interfaces
  7. #include "amstream.h" // DirectShow multimedia stream interfaces
  8. #include "ddstream.h" // DirectDraw multimedia stream interfaces
  9. #include "bands.h"
  10. #include "sccls.h"
  11. #include "power.h"
  12. class CMegaMan : public CToolBand,
  13. public IWinEventHandler
  14. {
  15. public:
  16. // *** IUnknown ***
  17. virtual STDMETHODIMP_(ULONG) AddRef(void)
  18. { return CToolBand::AddRef(); };
  19. virtual STDMETHODIMP_(ULONG) Release(void)
  20. { return CToolBand::Release(); };
  21. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  22. // *** IOleWindow methods ***
  23. virtual STDMETHODIMP GetWindow(HWND * phwnd);
  24. virtual STDMETHODIMP ContextSensitiveHelp(BOOL bEnterMode) {return E_NOTIMPL;};
  25. // *** IDeskBar methods ***
  26. virtual STDMETHODIMP SetClient(IUnknown* punk) { return E_NOTIMPL; };
  27. virtual STDMETHODIMP GetClient(IUnknown** ppunkClient) { return E_NOTIMPL; };
  28. virtual STDMETHODIMP OnPosRectChangeDB (LPRECT prc) { return E_NOTIMPL;};
  29. // ** IWinEventHandler ***
  30. virtual STDMETHODIMP IsWindowOwner(HWND hwnd);
  31. virtual STDMETHODIMP OnWinEvent(HWND hwnd, UINT dwMsg, WPARAM wParam, LPARAM lParam, LRESULT* plres);
  32. // *** IDeskBand methods ***
  33. virtual STDMETHODIMP GetBandInfo(DWORD dwBandID, DWORD fViewMode,
  34. DESKBANDINFO* pdbi);
  35. // *** IDockingWindow methods (override) ***
  36. virtual STDMETHODIMP ShowDW(BOOL fShow);
  37. virtual STDMETHODIMP CloseDW(DWORD dw);
  38. // *** IInputObject methods (override) ***
  39. virtual STDMETHODIMP TranslateAcceleratorIO(LPMSG lpMsg);
  40. virtual STDMETHODIMP HasFocusIO();
  41. virtual STDMETHODIMP UIActivateIO(BOOL fActivate, LPMSG lpMsg);
  42. virtual STDMETHODIMP GetClassID(CLSID *pClassID);
  43. virtual STDMETHODIMP Load(IStream *pStm);
  44. virtual STDMETHODIMP Save(IStream *pStm, BOOL fClearDirty);
  45. CMegaMan();
  46. private:
  47. virtual ~CMegaMan();
  48. HWND _CreateWindow(HWND hwndParent);
  49. friend HRESULT CMegaMan_CreateInstance(IUnknown *punk, REFIID riid, void **ppv);
  50. };
  51. CMegaMan::CMegaMan()
  52. {
  53. }
  54. CMegaMan::~CMegaMan()
  55. {
  56. }
  57. HWND CMegaMan::_CreateWindow(HWND hwndParent)
  58. {
  59. if (_hwnd)
  60. return _hwnd;
  61. _hwnd = CreateWindow(TEXT("Button"), TEXT("Sup"),
  62. WS_VISIBLE | WS_CHILD | TBSTYLE_FLAT |
  63. WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
  64. 0, 0, 0, 0, hwndParent, (HMENU) 0, HINST_THISDLL, NULL);
  65. return _hwnd;
  66. }
  67. STDMETHODIMP CMegaMan::QueryInterface(REFIID riid, LPVOID * ppvObj)
  68. {
  69. static const QITAB qit[] = {
  70. QITABENT(CMegaMan, IWinEventHandler),
  71. { 0 },
  72. };
  73. HRESULT hres = QISearch(this, qit, riid, ppvObj);
  74. if (FAILED(hres))
  75. hres = CToolBand::QueryInterface(riid, ppvObj);
  76. return hres;
  77. }
  78. STDMETHODIMP CMegaMan::GetWindow(HWND * phwnd)
  79. {
  80. *phwnd = _CreateWindow(_hwndParent);
  81. return *phwnd? S_OK : E_FAIL;
  82. }
  83. STDMETHODIMP CMegaMan::GetBandInfo(DWORD dwBandID, DWORD fViewMode,
  84. DESKBANDINFO* pdbi)
  85. {
  86. UINT ucy = 50;
  87. UINT ucx = 50;
  88. #if 0
  89. if (fViewMode & (DBIF_VIEWMODE_FLOATING |DBIF_VIEWMODE_VERTICAL))
  90. {
  91. }
  92. else
  93. {
  94. }
  95. #endif
  96. _dwBandID = dwBandID;
  97. pdbi->ptMinSize.x = 0;
  98. pdbi->ptMinSize.y = ucy;
  99. pdbi->ptMaxSize.y = -1;
  100. pdbi->ptMaxSize.x = 32000;
  101. pdbi->ptActual.y = 0;
  102. pdbi->ptActual.x = 0;
  103. pdbi->ptIntegral.y = 1;
  104. pdbi->ptIntegral.x = 1;
  105. if (pdbi->dwMask & DBIM_TITLE)
  106. {
  107. StrCpy(pdbi->wszTitle, TEXT("MegaMan"));
  108. }
  109. return S_OK;
  110. }
  111. STDMETHODIMP CMegaMan::ShowDW(BOOL fShow)
  112. {
  113. return CToolBand::ShowDW(fShow);
  114. }
  115. STDMETHODIMP CMegaMan::CloseDW(DWORD dw)
  116. {
  117. return CToolBand::CloseDW(dw);
  118. }
  119. STDMETHODIMP CMegaMan::TranslateAcceleratorIO(LPMSG lpMsg)
  120. {
  121. return E_NOTIMPL;
  122. }
  123. STDMETHODIMP CMegaMan::HasFocusIO()
  124. {
  125. return E_NOTIMPL;
  126. }
  127. STDMETHODIMP CMegaMan::UIActivateIO(BOOL fActivate, LPMSG lpMsg)
  128. {
  129. return S_OK;
  130. }
  131. STDMETHODIMP CMegaMan::IsWindowOwner(HWND hwnd)
  132. {
  133. return (hwnd == _hwnd)? S_OK : S_FALSE;
  134. }
  135. STDMETHODIMP CMegaMan::OnWinEvent(HWND hwnd, UINT dwMsg, WPARAM wParam, LPARAM lParam, LRESULT* plres)
  136. {
  137. HRESULT hres = S_FALSE;
  138. return hres;
  139. }
  140. HRESULT CMegaMan_CreateInstance(IUnknown *punk, REFIID riid, void **ppv)
  141. {
  142. HRESULT hr;
  143. CMegaMan *pmm = new CMegaMan;
  144. if (pmm)
  145. {
  146. hr = pmm->QueryInterface(riid, ppv);
  147. pmm->Release();
  148. }
  149. else
  150. {
  151. hr = E_OUTOFMEMORY;
  152. *ppv = NULL;
  153. }
  154. return hr;
  155. }
  156. STDMETHODIMP CMegaMan::GetClassID(CLSID *pClassID)
  157. {
  158. *pClassID = CLSID_MegaMan;
  159. return S_OK;
  160. }
  161. STDMETHODIMP CMegaMan::Load(IStream *pStm)
  162. {
  163. return S_OK;
  164. }
  165. STDMETHODIMP CMegaMan::Save(IStream *pStm, BOOL fClearDirty)
  166. {
  167. return S_OK;
  168. }