contnr.cpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979
  1. /**************************************************************************
  2. THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF
  3. ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  4. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  5. PARTICULAR PURPOSE.
  6. Copyright 1998 Microsoft Corporation. All Rights Reserved.
  7. **************************************************************************/
  8. /**************************************************************************
  9. File: contnr.cpp
  10. Description: This file contains the complete implementation of an
  11. ActiveX control container. This purpose of this container
  12. is to test a single control being hosted.
  13. **************************************************************************/
  14. /**************************************************************************
  15. #include statements
  16. **************************************************************************/
  17. #include "main.h"
  18. #include <windows.h>
  19. #include <commctrl.h>
  20. #include "contnr.h"
  21. #include <mshtmdid.h>
  22. #include <shlobj.h>
  23. #include "ml_local.h"
  24. /**************************************************************************
  25. CContainer::CContainer()
  26. **************************************************************************/
  27. extern IDispatch *winampExternal;
  28. CContainer::CContainer()
  29. {
  30. m_cRefs = 1;
  31. m_hwnd = NULL;
  32. m_punk = NULL;
  33. m_scrollbars= 1;
  34. m_allowScripts=1;
  35. m_restrictAlreadySet=0;
  36. m_hwndStatus = 0;
  37. }
  38. /**************************************************************************
  39. CContainer::~CContainer()
  40. **************************************************************************/
  41. CContainer::~CContainer()
  42. {
  43. if (m_punk)
  44. {
  45. m_punk->Release();
  46. m_punk=NULL;
  47. }
  48. }
  49. /**************************************************************************
  50. CContainer::QueryInterface()
  51. **************************************************************************/
  52. STDMETHODIMP CContainer::QueryInterface(REFIID riid, PVOID *ppvObject)
  53. {
  54. if (!ppvObject)
  55. return E_POINTER;
  56. if (IsEqualIID(riid, IID_IOleClientSite))
  57. *ppvObject = (IOleClientSite *)this;
  58. else if (IsEqualIID(riid, IID_IOleInPlaceSite))
  59. *ppvObject = (IOleInPlaceSite *)this;
  60. else if (IsEqualIID(riid, IID_IOleInPlaceFrame))
  61. *ppvObject = (IOleInPlaceFrame *)this;
  62. else if (IsEqualIID(riid, IID_IOleInPlaceUIWindow))
  63. *ppvObject = (IOleInPlaceUIWindow *)this;
  64. else if (IsEqualIID(riid, IID_IOleControlSite))
  65. *ppvObject = (IOleControlSite *)this;
  66. else if (IsEqualIID(riid, IID_IOleWindow))
  67. *ppvObject = this;
  68. else if (IsEqualIID(riid, IID_IDispatch))
  69. *ppvObject = (IDispatch *)this;
  70. else if (IsEqualIID(riid, IID_IUnknown))
  71. *ppvObject = this;
  72. else if (IsEqualIID(riid, IID_IDocHostUIHandler))
  73. *ppvObject = (IDocHostUIHandler *)this;
  74. else
  75. {
  76. *ppvObject = NULL;
  77. return E_NOINTERFACE;
  78. }
  79. AddRef();
  80. return S_OK;
  81. }
  82. /**************************************************************************
  83. CContainer::AddRef()
  84. **************************************************************************/
  85. ULONG CContainer::AddRef(void)
  86. {
  87. return ++m_cRefs;
  88. }
  89. /**************************************************************************
  90. CContainer::Release()
  91. **************************************************************************/
  92. ULONG CContainer::Release(void)
  93. {
  94. if (--m_cRefs)
  95. return m_cRefs;
  96. delete this;
  97. return 0;
  98. }
  99. /**************************************************************************
  100. CContainer::SaveObject()
  101. **************************************************************************/
  102. HRESULT CContainer::SaveObject()
  103. {
  104. return E_NOTIMPL;
  105. }
  106. /**************************************************************************
  107. CContainer::GetMoniker()
  108. **************************************************************************/
  109. HRESULT CContainer::GetMoniker(DWORD dwAssign, DWORD dwWhichMoniker, LPMONIKER * ppMk)
  110. {
  111. return E_NOTIMPL;
  112. }
  113. /**************************************************************************
  114. CContainer::GetContainer()
  115. **************************************************************************/
  116. HRESULT CContainer::GetContainer(LPOLECONTAINER * ppContainer)
  117. {
  118. return E_NOINTERFACE;
  119. }
  120. /**************************************************************************
  121. CContainer::ShowObject()
  122. **************************************************************************/
  123. HRESULT CContainer::ShowObject()
  124. {
  125. return S_OK;
  126. }
  127. /**************************************************************************
  128. CContainer::OnShowWindow()
  129. **************************************************************************/
  130. HRESULT CContainer::OnShowWindow(BOOL fShow)
  131. {
  132. return S_OK;
  133. }
  134. /**************************************************************************
  135. CContainer::RequestNewObjectLayout()
  136. **************************************************************************/
  137. HRESULT CContainer::RequestNewObjectLayout()
  138. {
  139. return E_NOTIMPL;
  140. }
  141. // ***********************************************************************
  142. // IOleWindow
  143. // ***********************************************************************
  144. /**************************************************************************
  145. CContainer::GetWindow()
  146. **************************************************************************/
  147. HRESULT CContainer::GetWindow(HWND * lphwnd)
  148. {
  149. if (!IsWindow(m_hwnd))
  150. return S_FALSE;
  151. *lphwnd = m_hwnd;
  152. return S_OK;
  153. }
  154. /**************************************************************************
  155. CContainer::ContextSensitiveHelp()
  156. **************************************************************************/
  157. HRESULT CContainer::ContextSensitiveHelp(BOOL fEnterMode)
  158. {
  159. return E_NOTIMPL;
  160. }
  161. // ***********************************************************************
  162. // IOleInPlaceSite
  163. // ***********************************************************************
  164. /**************************************************************************
  165. CContainer::CanInPlaceActivate()
  166. **************************************************************************/
  167. HRESULT CContainer::CanInPlaceActivate(void)
  168. {
  169. return S_OK;
  170. }
  171. /**************************************************************************
  172. CContainer::OnInPlaceActivate()
  173. **************************************************************************/
  174. HRESULT CContainer::OnInPlaceActivate(void)
  175. {
  176. return S_OK;
  177. }
  178. /**************************************************************************
  179. CContainer::OnUIActivate()
  180. **************************************************************************/
  181. HRESULT CContainer::OnUIActivate(void)
  182. {
  183. return S_OK;
  184. }
  185. /**************************************************************************
  186. CContainer::GetWindowContext()
  187. **************************************************************************/
  188. HRESULT CContainer::GetWindowContext (IOleInPlaceFrame ** ppFrame, IOleInPlaceUIWindow ** ppIIPUIWin,
  189. LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
  190. {
  191. *ppFrame = (IOleInPlaceFrame *)this;
  192. *ppIIPUIWin = NULL;
  193. RECT rect;
  194. GetClientRect(m_hwnd, &rect);
  195. lprcPosRect->left = 0;
  196. lprcPosRect->top = 0;
  197. lprcPosRect->right = rect.right;
  198. lprcPosRect->bottom = rect.bottom;
  199. CopyRect(lprcClipRect, lprcPosRect);
  200. lpFrameInfo->cb = sizeof(OLEINPLACEFRAMEINFO);
  201. lpFrameInfo->fMDIApp = FALSE;
  202. lpFrameInfo->hwndFrame = m_hwnd;
  203. lpFrameInfo->haccel = 0;
  204. lpFrameInfo->cAccelEntries = 0;
  205. (*ppFrame)->AddRef();
  206. return S_OK;
  207. }
  208. /**************************************************************************
  209. CContainer::Scroll()
  210. **************************************************************************/
  211. HRESULT CContainer::Scroll(SIZE scrollExtent)
  212. {
  213. return E_NOTIMPL;
  214. }
  215. /**************************************************************************
  216. CContainer::OnUIDeactivate()
  217. **************************************************************************/
  218. HRESULT CContainer::OnUIDeactivate(BOOL fUndoable)
  219. {
  220. return S_OK;
  221. }
  222. /**************************************************************************
  223. CContainer::OnInPlaceDeactivate()
  224. **************************************************************************/
  225. HRESULT CContainer::OnInPlaceDeactivate(void)
  226. {
  227. return S_OK;
  228. }
  229. /**************************************************************************
  230. CContainer::DiscardUndoState()
  231. **************************************************************************/
  232. HRESULT CContainer::DiscardUndoState(void)
  233. {
  234. return E_NOTIMPL;
  235. }
  236. /**************************************************************************
  237. CContainer::DeactivateAndUndo()
  238. **************************************************************************/
  239. HRESULT CContainer::DeactivateAndUndo(void)
  240. {
  241. return E_NOTIMPL;
  242. }
  243. /**************************************************************************
  244. CContainer::OnPosRectChange()
  245. **************************************************************************/
  246. HRESULT CContainer::OnPosRectChange(LPCRECT lprcPosRect)
  247. {
  248. HRESULT hr;
  249. IOleInPlaceObject *pipo;
  250. hr = m_punk->QueryInterface(IID_IOleInPlaceObject, (PVOID *)&pipo);
  251. if (SUCCEEDED(hr))
  252. {
  253. pipo->SetObjectRects(lprcPosRect, lprcPosRect);
  254. pipo->Release();
  255. }
  256. return(S_OK);
  257. }
  258. // ***********************************************************************
  259. // IOleInPlaceUIWindow
  260. // ***********************************************************************
  261. /**************************************************************************
  262. CContainer::GetBorder()
  263. **************************************************************************/
  264. HRESULT CContainer::GetBorder(LPRECT lprectBorder)
  265. {
  266. return E_NOTIMPL;
  267. }
  268. /**************************************************************************
  269. CContainer::RequestBorderSpace()
  270. **************************************************************************/
  271. HRESULT CContainer::RequestBorderSpace(LPCBORDERWIDTHS lpborderwidths)
  272. {
  273. return E_NOTIMPL;
  274. }
  275. /**************************************************************************
  276. CContainer::SetBorderSpace()
  277. **************************************************************************/
  278. HRESULT CContainer::SetBorderSpace(LPCBORDERWIDTHS lpborderwidths)
  279. {
  280. return E_NOTIMPL;
  281. }
  282. /**************************************************************************
  283. CContainer::SetActiveObject()
  284. **************************************************************************/
  285. HRESULT CContainer::SetActiveObject(IOleInPlaceActiveObject * pActiveObject, LPCOLESTR lpszObjName)
  286. {
  287. return S_OK;
  288. }
  289. // ***********************************************************************
  290. // IOleInPlaceFrame
  291. // ***********************************************************************
  292. /**************************************************************************
  293. CContainer::InsertMenus()
  294. **************************************************************************/
  295. HRESULT CContainer::InsertMenus(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
  296. {
  297. return E_NOTIMPL;
  298. }
  299. /**************************************************************************
  300. CContainer::SetMenu()
  301. **************************************************************************/
  302. HRESULT CContainer::SetMenu(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject)
  303. {
  304. return S_OK;
  305. }
  306. /**************************************************************************
  307. CContainer::RemoveMenus()
  308. **************************************************************************/
  309. HRESULT CContainer::RemoveMenus(HMENU hmenuShared)
  310. {
  311. return E_NOTIMPL;
  312. }
  313. /**************************************************************************
  314. CContainer::SetStatusText()
  315. **************************************************************************/
  316. HRESULT CContainer::SetStatusText(LPCOLESTR pszStatusText)
  317. {
  318. char status[MAX_PATH]; // ansi version of status text
  319. if (NULL == pszStatusText)
  320. return E_POINTER;
  321. WideCharToMultiByte(CP_ACP, 0, pszStatusText, -1, status, MAX_PATH, NULL, NULL);
  322. if (IsWindow(m_hwndStatus))
  323. SendMessage(m_hwndStatus, SB_SETTEXT, (WPARAM)0, (LPARAM)status);
  324. return (S_OK);
  325. }
  326. /**************************************************************************
  327. CContainer::EnableModeless()
  328. **************************************************************************/
  329. HRESULT CContainer::EnableModeless(BOOL fEnable)
  330. {
  331. return S_OK;
  332. }
  333. /**************************************************************************
  334. CContainer::TranslateAccelerator()
  335. **************************************************************************/
  336. HRESULT CContainer::TranslateAccelerator(LPMSG lpmsg, WORD wID)
  337. {
  338. return E_NOTIMPL;
  339. }
  340. // ***********************************************************************
  341. // IOleControlSite
  342. // ***********************************************************************
  343. /**************************************************************************
  344. CContainer::OnControlInfoChanged()
  345. **************************************************************************/
  346. HRESULT CContainer::OnControlInfoChanged()
  347. {
  348. return E_NOTIMPL;
  349. }
  350. /**************************************************************************
  351. CContainer::LockInPlaceActive()
  352. **************************************************************************/
  353. HRESULT CContainer::LockInPlaceActive(BOOL fLock)
  354. {
  355. return E_NOTIMPL;
  356. }
  357. /**************************************************************************
  358. CContainer::GetExtendedControl()
  359. **************************************************************************/
  360. HRESULT CContainer::GetExtendedControl(IDispatch **ppDisp)
  361. {
  362. if (ppDisp == NULL)
  363. return E_INVALIDARG;
  364. *ppDisp = (IDispatch *)this;
  365. (*ppDisp)->AddRef();
  366. return S_OK;
  367. }
  368. /**************************************************************************
  369. CContainer::TransformCoords()
  370. **************************************************************************/
  371. HRESULT CContainer::TransformCoords(POINTL *pptlHimetric, POINTF *pptfContainer, DWORD dwFlags)
  372. {
  373. return E_NOTIMPL;
  374. }
  375. /**************************************************************************
  376. CContainer::TranslateAccelerator()
  377. **************************************************************************/
  378. HRESULT CContainer::TranslateAccelerator(LPMSG pMsg, DWORD grfModifiers)
  379. {
  380. return S_FALSE;
  381. }
  382. /**************************************************************************
  383. CContainer::OnFocus()
  384. **************************************************************************/
  385. HRESULT CContainer::OnFocus(BOOL fGotFocus)
  386. {
  387. return E_NOTIMPL;
  388. }
  389. /**************************************************************************
  390. CContainer::ShowPropertyFrame()
  391. **************************************************************************/
  392. HRESULT CContainer::ShowPropertyFrame(void)
  393. {
  394. return E_NOTIMPL;
  395. }
  396. // ***********************************************************************
  397. // IDispatch
  398. // ***********************************************************************
  399. /**************************************************************************
  400. CContainer::GetIDsOfNames()
  401. **************************************************************************/
  402. HRESULT CContainer::GetIDsOfNames(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid)
  403. {
  404. *rgdispid = DISPID_UNKNOWN;
  405. return DISP_E_UNKNOWNNAME;
  406. }
  407. /**************************************************************************
  408. CContainer::GetTypeInfo()
  409. **************************************************************************/
  410. HRESULT CContainer::GetTypeInfo(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo)
  411. {
  412. return E_NOTIMPL;
  413. }
  414. /**************************************************************************
  415. CContainer::GetTypeInfoCount()
  416. **************************************************************************/
  417. HRESULT CContainer::GetTypeInfoCount(unsigned int FAR * pctinfo)
  418. {
  419. return E_NOTIMPL;
  420. }
  421. /**************************************************************************
  422. CContainer::Invoke()
  423. **************************************************************************/
  424. HRESULT CContainer::Invoke(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr)
  425. {
  426. if(dispid==DISPID_AMBIENT_DLCONTROL)
  427. {
  428. m_restrictAlreadySet=1;
  429. if(!m_allowScripts)
  430. {
  431. pvarResult->vt = VT_I4;
  432. pvarResult->lVal = DLCTL_DLIMAGES|DLCTL_NO_SCRIPTS|DLCTL_NO_DLACTIVEXCTLS|DLCTL_NO_RUNACTIVEXCTLS|DLCTL_NO_JAVA;
  433. return S_OK;
  434. }
  435. }
  436. return DISP_E_MEMBERNOTFOUND;
  437. }
  438. // ***********************************************************************
  439. // Public (non-interface) Methods
  440. // ***********************************************************************
  441. /**************************************************************************
  442. CContainer::add()
  443. **************************************************************************/
  444. void CContainer::add(BSTR bstrClsid)
  445. {
  446. CLSID clsid; // CLSID of the control object
  447. HRESULT hr; // return code
  448. CLSIDFromString(bstrClsid, &clsid);
  449. CoCreateInstance(clsid,
  450. NULL,
  451. CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
  452. IID_IUnknown,
  453. (PVOID *)&m_punk);
  454. if (!m_punk)
  455. return;
  456. IOleObject *pioo;
  457. hr = m_punk->QueryInterface(IID_IOleObject, (PVOID *)&pioo);
  458. if (FAILED(hr))
  459. return;
  460. pioo->SetClientSite(this);
  461. pioo->Release();
  462. IPersistStreamInit *ppsi;
  463. hr = m_punk->QueryInterface(IID_IPersistStreamInit, (PVOID *)&ppsi);
  464. if (SUCCEEDED(hr))
  465. {
  466. ppsi->InitNew();
  467. ppsi->Release();
  468. }
  469. }
  470. /**************************************************************************
  471. CContainer::remove()
  472. **************************************************************************/
  473. void CContainer::remove()
  474. {
  475. if (!m_punk)
  476. return;
  477. HRESULT hr;
  478. IOleObject *pioo;
  479. IOleInPlaceObject *pipo;
  480. hr = m_punk->QueryInterface(IID_IOleObject, (PVOID *)&pioo);
  481. if (SUCCEEDED(hr))
  482. {
  483. pioo->Close(OLECLOSE_NOSAVE);
  484. pioo->SetClientSite(NULL);
  485. pioo->Release();
  486. }
  487. hr = m_punk->QueryInterface(IID_IOleInPlaceObject, (PVOID *)&pipo);
  488. if (SUCCEEDED(hr))
  489. {
  490. pipo->UIDeactivate();
  491. pipo->InPlaceDeactivate();
  492. pipo->Release();
  493. }
  494. m_punk->Release();
  495. m_punk = NULL;
  496. }
  497. /**************************************************************************
  498. CContainer::setParent()
  499. **************************************************************************/
  500. void CContainer::setParent(HWND hwndParent)
  501. {
  502. m_hwnd = hwndParent;
  503. }
  504. /**************************************************************************
  505. CContainer::setLocation()
  506. **************************************************************************/
  507. void CContainer::setLocation(int x, int y, int width, int height)
  508. {
  509. RECT rc;
  510. ::SetRect(&rc, x, y, x + width, y + height);
  511. if (!m_punk) return;
  512. HRESULT hr;
  513. IOleInPlaceObject *pipo;
  514. hr = m_punk->QueryInterface(IID_IOleInPlaceObject, (PVOID *)&pipo);
  515. if (FAILED(hr))
  516. return;
  517. pipo->SetObjectRects(&rc, &rc);
  518. pipo->Release();
  519. }
  520. BOOL CContainer::SetRect(RECT *prc)
  521. {
  522. HRESULT hr;
  523. IOleInPlaceObject *pipo;
  524. if (!m_punk) return FALSE;
  525. hr = m_punk->QueryInterface(IID_IOleInPlaceObject, (PVOID *)&pipo);
  526. if (SUCCEEDED(hr))
  527. {
  528. hr = pipo->SetObjectRects(prc, prc);
  529. pipo->Release();
  530. }
  531. return SUCCEEDED(hr);
  532. }
  533. /**************************************************************************
  534. CContainer::setVisible()
  535. **************************************************************************/
  536. void CContainer::setVisible(BOOL fVisible)
  537. {
  538. if (!m_punk)
  539. return;
  540. HRESULT hr;
  541. IOleObject *pioo;
  542. hr = m_punk->QueryInterface(IID_IOleObject, (PVOID *)&pioo);
  543. if (FAILED(hr))
  544. return;
  545. if (fVisible)
  546. {
  547. pioo->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, this, 0, m_hwnd, NULL);
  548. pioo->DoVerb(OLEIVERB_SHOW, NULL, this, 0, m_hwnd, NULL);
  549. }
  550. else
  551. pioo->DoVerb(OLEIVERB_HIDE, NULL, this, 0, m_hwnd, NULL);
  552. pioo->Release();
  553. }
  554. /**************************************************************************
  555. CContainer::setFocus()
  556. **************************************************************************/
  557. void CContainer::setFocus(BOOL fFocus)
  558. {
  559. if (!m_punk)
  560. return;
  561. if (fFocus)
  562. {
  563. IOleObject *pioo;
  564. HRESULT hr = m_punk->QueryInterface(IID_IOleObject, (PVOID *)&pioo);
  565. if (FAILED(hr))
  566. return;
  567. pioo->DoVerb(OLEIVERB_UIACTIVATE, NULL, this, 0, m_hwnd, NULL);
  568. pioo->Release();
  569. }
  570. }
  571. /**************************************************************************
  572. CContainer::setStatusWindow()
  573. **************************************************************************/
  574. void CContainer::setStatusWindow(HWND hwndStatus)
  575. {
  576. m_hwndStatus = hwndStatus;
  577. }
  578. /**************************************************************************
  579. CContainer::translateKey()
  580. **************************************************************************/
  581. void CContainer::translateKey(MSG msg)
  582. {
  583. if (!m_punk)
  584. return;
  585. HRESULT hr;
  586. IOleInPlaceActiveObject *pao;
  587. hr = m_punk->QueryInterface(IID_IOleInPlaceActiveObject, (PVOID *)&pao);
  588. if (FAILED(hr))
  589. return;
  590. pao->TranslateAccelerator(&msg);
  591. pao->Release();
  592. }
  593. /**************************************************************************
  594. * CContainer::getDispatch()
  595. **************************************************************************/
  596. IDispatch * CContainer::getDispatch()
  597. {
  598. if (!m_punk)
  599. return NULL;
  600. IDispatch *pdisp;
  601. m_punk->QueryInterface(IID_IDispatch, (PVOID *)&pdisp);
  602. return pdisp;
  603. }
  604. /**************************************************************************
  605. * CContainer::getUnknown()
  606. **************************************************************************/
  607. IUnknown * CContainer::getUnknown()
  608. {
  609. if (!m_punk)
  610. return NULL;
  611. m_punk->AddRef();
  612. return m_punk;
  613. }
  614. void CContainer::setScrollbars(int scroll)
  615. {
  616. m_scrollbars=scroll;
  617. }
  618. // ***********************************************************************
  619. // IDocHostUIHandler
  620. // ***********************************************************************
  621. HRESULT CContainer::ShowContextMenu(DWORD dwID, POINT __RPC_FAR *ppt, IUnknown __RPC_FAR *pcmdtReserved, IDispatch __RPC_FAR *pdispReserved)
  622. {
  623. return E_NOTIMPL;
  624. }
  625. HRESULT CContainer::GetHostInfo(DOCHOSTUIINFO __RPC_FAR *pInfo)
  626. {
  627. pInfo->dwFlags=0x00200000|(m_scrollbars?0:8);
  628. return S_OK;
  629. }
  630. HRESULT CContainer::ShowUI(DWORD dwID, IOleInPlaceActiveObject __RPC_FAR *pActiveObject, IOleCommandTarget __RPC_FAR *pCommandTarget, IOleInPlaceFrame __RPC_FAR *pFrame, IOleInPlaceUIWindow __RPC_FAR *pDoc)
  631. {
  632. return E_NOTIMPL;
  633. }
  634. HRESULT CContainer::HideUI(void)
  635. {
  636. return E_NOTIMPL;
  637. }
  638. HRESULT CContainer::UpdateUI(void)
  639. {
  640. return E_NOTIMPL;
  641. }
  642. HRESULT CContainer::OnDocWindowActivate(BOOL fActivate)
  643. {
  644. return E_NOTIMPL;
  645. }
  646. HRESULT CContainer::OnFrameWindowActivate(BOOL fActivate)
  647. {
  648. return E_NOTIMPL;
  649. }
  650. HRESULT CContainer::ResizeBorder(LPCRECT prcBorder, IOleInPlaceUIWindow __RPC_FAR *pUIWindow, BOOL fRameWindow)
  651. {
  652. return E_NOTIMPL;
  653. }
  654. HRESULT CContainer::TranslateAccelerator(LPMSG lpMsg, const GUID __RPC_FAR *pguidCmdGroup, DWORD nCmdID)
  655. {
  656. return E_NOTIMPL;
  657. }
  658. HRESULT CContainer::GetOptionKeyPath(LPOLESTR __RPC_FAR *pchKey, DWORD dw)
  659. {
  660. return E_NOTIMPL;
  661. }
  662. HRESULT CContainer::GetDropTarget(IDropTarget __RPC_FAR *pDropTarget, IDropTarget __RPC_FAR *__RPC_FAR *ppDropTarget)
  663. {
  664. return E_NOTIMPL;
  665. }
  666. HRESULT CContainer::GetExternal(IDispatch __RPC_FAR *__RPC_FAR *ppDispatch)
  667. {
  668. *ppDispatch = winampExternal;
  669. return S_OK; //E_NOTIMPL;
  670. }
  671. HRESULT CContainer::TranslateUrl(DWORD dwTranslate, OLECHAR __RPC_FAR *pchURLIn, OLECHAR __RPC_FAR *__RPC_FAR *ppchURLOut)
  672. {
  673. return E_NOTIMPL;
  674. }
  675. HRESULT CContainer::FilterDataObject(IDataObject __RPC_FAR *pDO, IDataObject __RPC_FAR *__RPC_FAR *ppDORet)
  676. {
  677. return E_NOTIMPL;
  678. }