2 * Copyright 2014 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "wmp_private.h"
22 #include "wine/debug.h"
23 #include "wine/heap.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(wmp
);
27 static HWND
get_container_hwnd(WindowsMediaPlayer
*This
)
29 IOleWindow
*ole_window
;
33 /* IOleInPlaceSite (which inherits from IOleWindow) is preferred. */
34 hres
= IOleClientSite_QueryInterface(This
->client_site
, &IID_IOleInPlaceSite
, (void**)&ole_window
);
36 hres
= IOleClientSite_QueryInterface(This
->client_site
, &IID_IOleWindow
, (void**)&ole_window
);
38 IOleContainer
*container
= NULL
;
40 hres
= IOleClientSite_GetContainer(This
->client_site
, &container
);
42 hres
= IOleContainer_QueryInterface(container
, &IID_IOleWindow
, (void**)&ole_window
);
43 IOleContainer_Release(container
);
51 hres
= IOleWindow_GetWindow(ole_window
, &hwnd
);
52 IOleWindow_Release(ole_window
);
56 TRACE("Got window %p\n", hwnd
);
60 static LRESULT WINAPI
wmp_wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
71 GetClientRect(hwnd
, &rect
);
72 hdc
= BeginPaint(hwnd
, &ps
);
74 SelectObject(hdc
, GetStockObject(DC_BRUSH
));
75 SetDCBrushColor(hdc
, RGB(255,0,0));
76 SetBkColor(hdc
, RGB(255,0,0));
78 font
= CreateFontA(25,0,0,0,400,0,0,0,ANSI_CHARSET
,0,0,DEFAULT_QUALITY
,DEFAULT_PITCH
,NULL
);
79 SelectObject(hdc
, font
);
81 Rectangle(hdc
, rect
.left
, rect
.top
, rect
.right
, rect
.bottom
);
82 DrawTextA(hdc
, "FIXME: WMP", -1, &rect
, DT_CENTER
| DT_SINGLELINE
| DT_VCENTER
);
90 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
94 static ATOM wmp_class
;
96 static BOOL WINAPI
register_wmp_class(INIT_ONCE
*once
, void *param
, void **context
)
98 /* It seems that native uses ATL for this. We use a fake name to make tests happy. */
99 static const WCHAR atl_wmpW
[] = {'A','T','L',':','W','M','P',0};
101 static WNDCLASSEXW wndclass
= {
102 sizeof(wndclass
), CS_DBLCLKS
, wmp_wnd_proc
, 0, 0,
103 NULL
, NULL
, NULL
, NULL
, NULL
,
107 wndclass
.hInstance
= wmp_instance
;
108 wmp_class
= RegisterClassExW(&wndclass
);
112 void unregister_wmp_class(void)
115 UnregisterClassW(MAKEINTRESOURCEW(wmp_class
), wmp_instance
);
118 static HWND
create_wmp_window(WindowsMediaPlayer
*wmp
, const RECT
*posrect
)
120 static INIT_ONCE class_init_once
= INIT_ONCE_STATIC_INIT
;
122 InitOnceExecuteOnce(&class_init_once
, register_wmp_class
, NULL
, NULL
);
126 return CreateWindowExW(0, MAKEINTRESOURCEW(wmp_class
), NULL
, WS_CLIPCHILDREN
|WS_CLIPSIBLINGS
|WS_VISIBLE
|WS_CHILD
,
127 posrect
->left
, posrect
->top
, posrect
->right
-posrect
->left
, posrect
->bottom
-posrect
->top
,
128 get_container_hwnd(wmp
), NULL
, wmp_instance
, NULL
);
131 static HRESULT
activate_inplace(WindowsMediaPlayer
*This
)
133 IOleInPlaceSiteWindowless
*ipsite_windowless
;
134 IOleInPlaceSiteEx
*ipsiteex
= NULL
;
135 IOleInPlaceSite
*ipsite
;
136 IOleInPlaceUIWindow
*ip_window
= NULL
;
137 IOleInPlaceFrame
*ip_frame
= NULL
;
138 RECT posrect
= {0}, cliprect
= {0};
139 OLEINPLACEFRAMEINFO frameinfo
= { sizeof(frameinfo
) };
143 FIXME("Already activated\n");
147 hres
= IOleClientSite_QueryInterface(This
->client_site
, &IID_IOleInPlaceSiteWindowless
, (void**)&ipsite_windowless
);
148 if(SUCCEEDED(hres
)) {
149 hres
= IOleInPlaceSiteWindowless_CanWindowlessActivate(ipsite_windowless
);
150 IOleInPlaceSiteWindowless_Release(ipsite_windowless
);
152 FIXME("Windowless activation not supported\n");
153 ipsiteex
= (IOleInPlaceSiteEx
*)ipsite_windowless
;
155 IOleClientSite_QueryInterface(This
->client_site
, &IID_IOleInPlaceSiteEx
, (void**)&ipsiteex
);
159 BOOL redraw
= FALSE
; /* Not really used. */
160 IOleInPlaceSiteEx_OnInPlaceActivateEx(ipsiteex
, &redraw
, 0);
161 ipsite
= (IOleInPlaceSite
*)ipsiteex
;
163 IOleClientSite_QueryInterface(This
->client_site
, &IID_IOleInPlaceSite
, (void**)&ipsite
);
165 FIXME("No IOleInPlaceSite instance\n");
169 IOleInPlaceSite_OnInPlaceActivate(ipsite
);
172 hres
= IOleInPlaceSite_GetWindowContext(ipsite
, &ip_frame
, &ip_window
, &posrect
, &cliprect
, &frameinfo
);
173 IOleInPlaceSite_Release(ipsite
);
175 FIXME("GetWindowContext failed: %08x\n", hres
);
179 This
->hwnd
= create_wmp_window(This
, &posrect
);
183 IOleClientSite_ShowObject(This
->client_site
);
187 static void deactivate_window(WindowsMediaPlayer
*This
)
189 IOleInPlaceSite
*ip_site
;
192 hres
= IOleClientSite_QueryInterface(This
->client_site
, &IID_IOleInPlaceSite
, (void**)&ip_site
);
193 if(SUCCEEDED(hres
)) {
194 IOleInPlaceSite_OnInPlaceDeactivate(ip_site
);
195 IOleInPlaceSite_Release(ip_site
);
198 DestroyWindow(This
->hwnd
);
202 static void release_client_site(WindowsMediaPlayer
*This
)
204 if(!This
->client_site
)
208 deactivate_window(This
);
210 IOleClientSite_Release(This
->client_site
);
211 This
->client_site
= NULL
;
214 static inline WindowsMediaPlayer
*impl_from_IOleObject(IOleObject
*iface
)
216 return CONTAINING_RECORD(iface
, WindowsMediaPlayer
, IOleObject_iface
);
219 static HRESULT WINAPI
OleObject_QueryInterface(IOleObject
*iface
, REFIID riid
, void **ppv
)
221 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
225 if(IsEqualGUID(riid
, &IID_IUnknown
)) {
226 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
227 *ppv
= &This
->IOleObject_iface
;
228 }else if(IsEqualGUID(riid
, &IID_IOleObject
)) {
229 TRACE("(%p)->(IID_IOleObject %p)\n", This
, ppv
);
230 *ppv
= &This
->IOleObject_iface
;
231 }else if(IsEqualGUID(riid
, &IID_IProvideClassInfo
)) {
232 TRACE("(%p)->(IID_IProvideClassInfo %p)\n", This
, ppv
);
233 *ppv
= &This
->IProvideClassInfo2_iface
;
234 }else if(IsEqualGUID(riid
, &IID_IProvideClassInfo2
)) {
235 TRACE("(%p)->(IID_IProvideClassInfo2 %p)\n", This
, ppv
);
236 *ppv
= &This
->IProvideClassInfo2_iface
;
237 }else if(IsEqualGUID(riid
, &IID_IPersist
)) {
238 TRACE("(%p)->(IID_IPersist %p)\n", This
, ppv
);
239 *ppv
= &This
->IPersistStreamInit_iface
;
240 }else if(IsEqualGUID(riid
, &IID_IPersistStreamInit
)) {
241 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This
, ppv
);
242 *ppv
= &This
->IPersistStreamInit_iface
;
243 }else if(IsEqualGUID(riid
, &IID_IOleWindow
)) {
244 TRACE("(%p)->(IID_IOleWindow %p)\n", This
, ppv
);
245 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
246 }else if(IsEqualGUID(riid
, &IID_IOleInPlaceObject
)) {
247 TRACE("(%p)->(IID_IOleInPlaceObject %p)\n", This
, ppv
);
248 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
249 }else if(IsEqualGUID(riid
, &IID_IOleInPlaceObjectWindowless
)) {
250 TRACE("(%p)->(IID_IOleInPlaceObjectWindowless %p)\n", This
, ppv
);
251 *ppv
= &This
->IOleInPlaceObjectWindowless_iface
;
252 }else if(IsEqualGUID(riid
, &IID_IConnectionPointContainer
)) {
253 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This
, ppv
);
254 *ppv
= &This
->IConnectionPointContainer_iface
;
255 }else if(IsEqualGUID(riid
, &IID_IWMPCore
)) {
256 TRACE("(%p)->(IID_IWMPCore %p)\n", This
, ppv
);
257 *ppv
= &This
->IWMPPlayer4_iface
;
258 }else if(IsEqualGUID(riid
, &IID_IWMPCore2
)) {
259 TRACE("(%p)->(IID_IWMPCore2 %p)\n", This
, ppv
);
260 *ppv
= &This
->IWMPPlayer4_iface
;
261 }else if(IsEqualGUID(riid
, &IID_IWMPCore3
)) {
262 TRACE("(%p)->(IID_IWMPCore3 %p)\n", This
, ppv
);
263 *ppv
= &This
->IWMPPlayer4_iface
;
264 }else if(IsEqualGUID(riid
, &IID_IWMPPlayer4
)) {
265 TRACE("(%p)->(IID_IWMPPlayer4 %p)\n", This
, ppv
);
266 *ppv
= &This
->IWMPPlayer4_iface
;
267 }else if(IsEqualGUID(riid
, &IID_IWMPPlayer
)) {
268 TRACE("(%p)->(IID_IWMPPlayer %p)\n", This
, ppv
);
269 *ppv
= &This
->IWMPPlayer_iface
;
270 }else if(IsEqualGUID(riid
, &IID_IWMPSettings
)) {
271 TRACE("(%p)->(IID_IWMPSettings %p)\n", This
, ppv
);
272 *ppv
= &This
->IWMPSettings_iface
;
273 }else if(IsEqualGUID(riid
, &IID_IOleControl
)) {
274 TRACE("(%p)->(IID_IOleControl %p)\n", This
, ppv
);
275 *ppv
= &This
->IOleControl_iface
;
276 }else if(IsEqualGUID(riid
, &IID_IMarshal
)) {
277 TRACE("(%p)->(IID_IMarshal %p)\n", This
, ppv
);
278 return E_NOINTERFACE
;
279 }else if(IsEqualGUID(riid
, &IID_IQuickActivate
)) {
280 TRACE("(%p)->(IID_IQuickActivate %p)\n", This
, ppv
);
281 return E_NOINTERFACE
;
283 FIXME("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
284 return E_NOINTERFACE
;
287 IUnknown_AddRef((IUnknown
*)*ppv
);
291 static ULONG WINAPI
OleObject_AddRef(IOleObject
*iface
)
293 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
294 LONG ref
= InterlockedIncrement(&This
->ref
);
296 TRACE("(%p) ref=%d\n", This
, ref
);
301 static ULONG WINAPI
OleObject_Release(IOleObject
*iface
)
303 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
304 LONG ref
= InterlockedDecrement(&This
->ref
);
306 TRACE("(%p) ref=%d\n", This
, ref
);
309 release_client_site(This
);
310 ConnectionPointContainer_Destroy(This
);
311 destroy_player(This
);
318 static HRESULT WINAPI
OleObject_SetClientSite(IOleObject
*iface
, IOleClientSite
*pClientSite
)
320 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
321 IOleControlSite
*control_site
;
324 TRACE("(%p)->(%p)\n", This
, pClientSite
);
326 release_client_site(This
);
330 IOleClientSite_AddRef(pClientSite
);
331 This
->client_site
= pClientSite
;
333 hres
= IOleClientSite_QueryInterface(pClientSite
, &IID_IOleControlSite
, (void**)&control_site
);
334 if(SUCCEEDED(hres
)) {
337 hres
= IOleControlSite_GetExtendedControl(control_site
, &disp
);
338 if(SUCCEEDED(hres
) && disp
) {
339 FIXME("Use extended control\n");
340 IDispatch_Release(disp
);
343 IOleControlSite_Release(control_site
);
349 static HRESULT WINAPI
OleObject_GetClientSite(IOleObject
*iface
, IOleClientSite
**ppClientSite
)
351 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
353 TRACE("(%p)->(%p)\n", This
, ppClientSite
);
355 *ppClientSite
= This
->client_site
;
356 return This
->client_site
? S_OK
: E_FAIL
;
359 static HRESULT WINAPI
OleObject_SetHostNames(IOleObject
*iface
, LPCOLESTR szContainerApp
, LPCOLESTR szContainerObj
)
361 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
362 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(szContainerApp
), debugstr_w(szContainerObj
));
366 static HRESULT WINAPI
OleObject_Close(IOleObject
*iface
, DWORD dwSaveOption
)
368 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
370 TRACE("(%p)->(%08x)\n", This
, dwSaveOption
);
373 FIXME("Unsupported option %d\n", dwSaveOption
);
375 if(This
->hwnd
) /* FIXME: Possibly hide window */
376 deactivate_window(This
);
380 static HRESULT WINAPI
OleObject_SetMoniker(IOleObject
*iface
, DWORD dwWhichMoniker
, IMoniker
*pmk
)
382 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
383 FIXME("(%p %d %p)->()\n", This
, dwWhichMoniker
, pmk
);
387 static HRESULT WINAPI
OleObject_GetMoniker(IOleObject
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
, IMoniker
**ppmk
)
389 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
390 FIXME("(%p)->(%d %d %p)\n", This
, dwAssign
, dwWhichMoniker
, ppmk
);
394 static HRESULT WINAPI
OleObject_InitFromData(IOleObject
*iface
, IDataObject
*pDataObject
, BOOL fCreation
,
397 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
398 FIXME("(%p)->(%p %x %d)\n", This
, pDataObject
, fCreation
, dwReserved
);
402 static HRESULT WINAPI
OleObject_GetClipboardData(IOleObject
*iface
, DWORD dwReserved
, IDataObject
**ppDataObject
)
404 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
405 FIXME("(%p)->(%d %p)\n", This
, dwReserved
, ppDataObject
);
409 static HRESULT WINAPI
OleObject_DoVerb(IOleObject
*iface
, LONG iVerb
, LPMSG lpmsg
, IOleClientSite
*pActiveSite
,
410 LONG lindex
, HWND hwndParent
, LPCRECT lprcPosRect
)
412 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
415 case OLEIVERB_INPLACEACTIVATE
:
416 TRACE("(%p)->(OLEIVERB_INPLACEACTIVATE)\n", This
);
417 return activate_inplace(This
);
421 FIXME("No window to hide\n");
425 ShowWindow(This
->hwnd
, SW_HIDE
);
429 FIXME("Unsupported iVerb %d\n", iVerb
);
435 static HRESULT WINAPI
OleObject_EnumVerbs(IOleObject
*iface
, IEnumOLEVERB
**ppEnumOleVerb
)
437 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
438 FIXME("(%p)->(%p)\n", This
, ppEnumOleVerb
);
442 static HRESULT WINAPI
OleObject_Update(IOleObject
*iface
)
444 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
445 FIXME("(%p)\n", This
);
449 static HRESULT WINAPI
OleObject_IsUpToDate(IOleObject
*iface
)
451 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
452 FIXME("(%p)\n", This
);
456 static HRESULT WINAPI
OleObject_GetUserClassID(IOleObject
*iface
, CLSID
*pClsid
)
458 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
459 FIXME("(%p)->(%p)\n", This
, pClsid
);
463 static HRESULT WINAPI
OleObject_GetUserType(IOleObject
*iface
, DWORD dwFormOfType
, LPOLESTR
*pszUserType
)
465 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
466 FIXME("(%p)->(%d %p)\n", This
, dwFormOfType
, pszUserType
);
470 static HRESULT WINAPI
OleObject_SetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
472 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
474 TRACE("(%p)->(%d %p)\n", This
, dwDrawAspect
, psizel
);
476 if(dwDrawAspect
!= DVASPECT_CONTENT
)
477 return DV_E_DVASPECT
;
479 This
->extent
= *psizel
;
483 static HRESULT WINAPI
OleObject_GetExtent(IOleObject
*iface
, DWORD dwDrawAspect
, SIZEL
*psizel
)
485 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
487 TRACE("(%p)->(%d %p)\n", This
, dwDrawAspect
, psizel
);
489 if(dwDrawAspect
!= DVASPECT_CONTENT
)
492 *psizel
= This
->extent
;
496 static HRESULT WINAPI
OleObject_Advise(IOleObject
*iface
, IAdviseSink
*pAdvSink
, DWORD
*pdwConnection
)
498 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
499 FIXME("(%p)->(%p %p)\n", This
, pAdvSink
, pdwConnection
);
503 static HRESULT WINAPI
OleObject_Unadvise(IOleObject
*iface
, DWORD dwConnection
)
505 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
506 FIXME("(%p)->(%d)\n", This
, dwConnection
);
510 static HRESULT WINAPI
OleObject_EnumAdvise(IOleObject
*iface
, IEnumSTATDATA
**ppenumAdvise
)
512 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
513 FIXME("(%p)->(%p)\n", This
, ppenumAdvise
);
517 static HRESULT WINAPI
OleObject_GetMiscStatus(IOleObject
*iface
, DWORD dwAspect
, DWORD
*pdwStatus
)
519 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
521 TRACE("(%p)->(%d %p)\n", This
, dwAspect
, pdwStatus
);
524 case DVASPECT_CONTENT
:
525 *pdwStatus
= OLEMISC_SETCLIENTSITEFIRST
|OLEMISC_ACTIVATEWHENVISIBLE
|OLEMISC_INSIDEOUT
526 |OLEMISC_CANTLINKINSIDE
|OLEMISC_RECOMPOSEONRESIZE
;
529 FIXME("Unhandled aspect %d\n", dwAspect
);
536 static HRESULT WINAPI
OleObject_SetColorScheme(IOleObject
*iface
, LOGPALETTE
*pLogpal
)
538 WindowsMediaPlayer
*This
= impl_from_IOleObject(iface
);
539 FIXME("(%p)->(%p)\n", This
, pLogpal
);
543 static const IOleObjectVtbl OleObjectVtbl
= {
544 OleObject_QueryInterface
,
547 OleObject_SetClientSite
,
548 OleObject_GetClientSite
,
549 OleObject_SetHostNames
,
551 OleObject_SetMoniker
,
552 OleObject_GetMoniker
,
553 OleObject_InitFromData
,
554 OleObject_GetClipboardData
,
558 OleObject_IsUpToDate
,
559 OleObject_GetUserClassID
,
560 OleObject_GetUserType
,
565 OleObject_EnumAdvise
,
566 OleObject_GetMiscStatus
,
567 OleObject_SetColorScheme
570 static inline WindowsMediaPlayer
*impl_from_IOleInPlaceObjectWindowless(IOleInPlaceObjectWindowless
*iface
)
572 return CONTAINING_RECORD(iface
, WindowsMediaPlayer
, IOleInPlaceObjectWindowless_iface
);
575 static HRESULT WINAPI
OleInPlaceObjectWindowless_QueryInterface(IOleInPlaceObjectWindowless
*iface
,
576 REFIID riid
, void **ppv
)
578 WindowsMediaPlayer
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
579 return IOleObject_QueryInterface(&This
->IOleObject_iface
, riid
, ppv
);
582 static ULONG WINAPI
OleInPlaceObjectWindowless_AddRef(IOleInPlaceObjectWindowless
*iface
)
584 WindowsMediaPlayer
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
585 return IOleObject_AddRef(&This
->IOleObject_iface
);
588 static ULONG WINAPI
OleInPlaceObjectWindowless_Release(IOleInPlaceObjectWindowless
*iface
)
590 WindowsMediaPlayer
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
591 return IOleObject_Release(&This
->IOleObject_iface
);
594 static HRESULT WINAPI
OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWindowless
*iface
, HWND
*phwnd
)
596 WindowsMediaPlayer
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
598 TRACE("(%p)->(%p)\n", This
, phwnd
);
601 return This
->hwnd
? S_OK
: E_UNEXPECTED
;
604 static HRESULT WINAPI
OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless
*iface
,
607 WindowsMediaPlayer
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
608 FIXME("(%p)->(%x)\n", This
, fEnterMode
);
612 static HRESULT WINAPI
OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless
*iface
)
614 WindowsMediaPlayer
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
615 FIXME("(%p)\n", This
);
619 static HRESULT WINAPI
OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless
*iface
)
621 WindowsMediaPlayer
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
622 FIXME("(%p)\n", This
);
626 static HRESULT WINAPI
OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless
*iface
,
627 LPCRECT lprcPosRect
, LPCRECT lprcClipRect
)
629 WindowsMediaPlayer
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
631 TRACE("(%p)->(%s %s)\n", This
, wine_dbgstr_rect(lprcPosRect
), wine_dbgstr_rect(lprcClipRect
));
634 SetWindowPos(This
->hwnd
, NULL
, lprcPosRect
->left
, lprcPosRect
->top
,
635 lprcPosRect
->right
-lprcPosRect
->left
, lprcPosRect
->bottom
-lprcPosRect
->top
,
636 SWP_NOZORDER
| SWP_NOACTIVATE
);
642 static HRESULT WINAPI
OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless
*iface
)
644 WindowsMediaPlayer
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
645 FIXME("(%p)\n", This
);
649 static HRESULT WINAPI
OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless
*iface
,
650 UINT msg
, WPARAM wParam
, LPARAM lParam
, LRESULT
*lpResult
)
652 WindowsMediaPlayer
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
653 FIXME("(%p)->(%u %lu %lu %p)\n", This
, msg
, wParam
, lParam
, lpResult
);
657 static HRESULT WINAPI
OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless
*iface
,
658 IDropTarget
**ppDropTarget
)
660 WindowsMediaPlayer
*This
= impl_from_IOleInPlaceObjectWindowless(iface
);
661 FIXME("(%p)->(%p)\n", This
, ppDropTarget
);
665 static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl
= {
666 OleInPlaceObjectWindowless_QueryInterface
,
667 OleInPlaceObjectWindowless_AddRef
,
668 OleInPlaceObjectWindowless_Release
,
669 OleInPlaceObjectWindowless_GetWindow
,
670 OleInPlaceObjectWindowless_ContextSensitiveHelp
,
671 OleInPlaceObjectWindowless_InPlaceDeactivate
,
672 OleInPlaceObjectWindowless_UIDeactivate
,
673 OleInPlaceObjectWindowless_SetObjectRects
,
674 OleInPlaceObjectWindowless_ReactivateAndUndo
,
675 OleInPlaceObjectWindowless_OnWindowMessage
,
676 OleInPlaceObjectWindowless_GetDropTarget
679 static inline WindowsMediaPlayer
*impl_from_IOleControl(IOleControl
*iface
)
681 return CONTAINING_RECORD(iface
, WindowsMediaPlayer
, IOleControl_iface
);
684 static HRESULT WINAPI
OleControl_QueryInterface(IOleControl
*iface
, REFIID riid
, void **ppv
)
686 WindowsMediaPlayer
*This
= impl_from_IOleControl(iface
);
687 return IOleObject_QueryInterface(&This
->IOleObject_iface
, riid
, ppv
);
690 static ULONG WINAPI
OleControl_AddRef(IOleControl
*iface
)
692 WindowsMediaPlayer
*This
= impl_from_IOleControl(iface
);
693 return IOleObject_AddRef(&This
->IOleObject_iface
);
696 static ULONG WINAPI
OleControl_Release(IOleControl
*iface
)
698 WindowsMediaPlayer
*This
= impl_from_IOleControl(iface
);
699 return IOleObject_Release(&This
->IOleObject_iface
);
702 static HRESULT WINAPI
OleControl_GetControlInfo(IOleControl
*iface
, CONTROLINFO
*pCI
)
704 WindowsMediaPlayer
*This
= impl_from_IOleControl(iface
);
705 FIXME("(%p)->(%p)\n", This
, pCI
);
709 static HRESULT WINAPI
OleControl_OnMnemonic(IOleControl
*iface
, MSG
*msg
)
711 WindowsMediaPlayer
*This
= impl_from_IOleControl(iface
);
712 FIXME("(%p)->(%p)\n", This
, msg
);
716 static HRESULT WINAPI
OleControl_OnAmbientPropertyChange(IOleControl
*iface
, DISPID dispID
)
718 WindowsMediaPlayer
*This
= impl_from_IOleControl(iface
);
719 FIXME("(%p)->(%d)\n", This
, dispID
);
723 static HRESULT WINAPI
OleControl_FreezeEvents(IOleControl
*iface
, BOOL freeze
)
725 WindowsMediaPlayer
*This
= impl_from_IOleControl(iface
);
726 FIXME("(%p)->(%x)\n", This
, freeze
);
730 static const IOleControlVtbl OleControlVtbl
= {
731 OleControl_QueryInterface
,
734 OleControl_GetControlInfo
,
735 OleControl_OnMnemonic
,
736 OleControl_OnAmbientPropertyChange
,
737 OleControl_FreezeEvents
740 static inline WindowsMediaPlayer
*impl_from_IProvideClassInfo2(IProvideClassInfo2
*iface
)
742 return CONTAINING_RECORD(iface
, WindowsMediaPlayer
, IProvideClassInfo2_iface
);
745 static HRESULT WINAPI
ProvideClassInfo2_QueryInterface(IProvideClassInfo2
*iface
, REFIID riid
, void **ppv
)
747 WindowsMediaPlayer
*This
= impl_from_IProvideClassInfo2(iface
);
748 return IOleObject_QueryInterface(&This
->IOleObject_iface
, riid
, ppv
);
751 static ULONG WINAPI
ProvideClassInfo2_AddRef(IProvideClassInfo2
*iface
)
753 WindowsMediaPlayer
*This
= impl_from_IProvideClassInfo2(iface
);
754 return IOleObject_AddRef(&This
->IOleObject_iface
);
757 static ULONG WINAPI
ProvideClassInfo2_Release(IProvideClassInfo2
*iface
)
759 WindowsMediaPlayer
*This
= impl_from_IProvideClassInfo2(iface
);
760 return IOleObject_Release(&This
->IOleObject_iface
);
763 static HRESULT WINAPI
ProvideClassInfo2_GetClassInfo(IProvideClassInfo2
*iface
, ITypeInfo
**ppTI
)
765 WindowsMediaPlayer
*This
= impl_from_IProvideClassInfo2(iface
);
766 FIXME("(%p)->(%p)\n", This
, ppTI
);
770 static HRESULT WINAPI
ProvideClassInfo2_GetGUID(IProvideClassInfo2
*iface
, DWORD dwGuidKind
, GUID
*pGUID
)
772 WindowsMediaPlayer
*This
= impl_from_IProvideClassInfo2(iface
);
774 TRACE("(%p)->(%d %p)\n", This
, dwGuidKind
, pGUID
);
776 if(dwGuidKind
!= GUIDKIND_DEFAULT_SOURCE_DISP_IID
) {
777 FIXME("Unexpected dwGuidKind %d\n", dwGuidKind
);
781 *pGUID
= IID__WMPOCXEvents
;
785 static const IProvideClassInfo2Vtbl ProvideClassInfo2Vtbl
= {
786 ProvideClassInfo2_QueryInterface
,
787 ProvideClassInfo2_AddRef
,
788 ProvideClassInfo2_Release
,
789 ProvideClassInfo2_GetClassInfo
,
790 ProvideClassInfo2_GetGUID
793 static inline WindowsMediaPlayer
*impl_from_IPersistStreamInit(IPersistStreamInit
*iface
)
795 return CONTAINING_RECORD(iface
, WindowsMediaPlayer
, IPersistStreamInit_iface
);
798 static HRESULT WINAPI
PersistStreamInit_QueryInterface(IPersistStreamInit
*iface
,
799 REFIID riid
, void **ppv
)
801 WindowsMediaPlayer
*This
= impl_from_IPersistStreamInit(iface
);
802 return IOleObject_QueryInterface(&This
->IOleObject_iface
, riid
, ppv
);
805 static ULONG WINAPI
PersistStreamInit_AddRef(IPersistStreamInit
*iface
)
807 WindowsMediaPlayer
*This
= impl_from_IPersistStreamInit(iface
);
808 return IOleObject_AddRef(&This
->IOleObject_iface
);
811 static ULONG WINAPI
PersistStreamInit_Release(IPersistStreamInit
*iface
)
813 WindowsMediaPlayer
*This
= impl_from_IPersistStreamInit(iface
);
814 return IOleObject_Release(&This
->IOleObject_iface
);
817 static HRESULT WINAPI
PersistStreamInit_GetClassID(IPersistStreamInit
*iface
, CLSID
*pClassID
)
819 WindowsMediaPlayer
*This
= impl_from_IPersistStreamInit(iface
);
820 FIXME("(%p)->(%p)\n", This
, pClassID
);
824 static HRESULT WINAPI
PersistStreamInit_IsDirty(IPersistStreamInit
*iface
)
826 WindowsMediaPlayer
*This
= impl_from_IPersistStreamInit(iface
);
827 FIXME("(%p)\n", This
);
831 static HRESULT WINAPI
PersistStreamInit_Load(IPersistStreamInit
*iface
, LPSTREAM pStm
)
833 WindowsMediaPlayer
*This
= impl_from_IPersistStreamInit(iface
);
834 FIXME("(%p)->(%p)\n", This
, pStm
);
838 static HRESULT WINAPI
PersistStreamInit_Save(IPersistStreamInit
*iface
, LPSTREAM pStm
,
841 WindowsMediaPlayer
*This
= impl_from_IPersistStreamInit(iface
);
842 FIXME("(%p)->(%p %x)\n", This
, pStm
, fClearDirty
);
846 static HRESULT WINAPI
PersistStreamInit_GetSizeMax(IPersistStreamInit
*iface
,
847 ULARGE_INTEGER
*pcbSize
)
849 WindowsMediaPlayer
*This
= impl_from_IPersistStreamInit(iface
);
850 FIXME("(%p)->(%p)\n", This
, pcbSize
);
854 static HRESULT WINAPI
PersistStreamInit_InitNew(IPersistStreamInit
*iface
)
856 WindowsMediaPlayer
*This
= impl_from_IPersistStreamInit(iface
);
858 TRACE("(%p)\n", This
);
860 if(!This
->client_site
)
863 /* Nothing to do, yet. */
864 get_container_hwnd(This
);
868 static const IPersistStreamInitVtbl PersistStreamInitVtbl
= {
869 PersistStreamInit_QueryInterface
,
870 PersistStreamInit_AddRef
,
871 PersistStreamInit_Release
,
872 PersistStreamInit_GetClassID
,
873 PersistStreamInit_IsDirty
,
874 PersistStreamInit_Load
,
875 PersistStreamInit_Save
,
876 PersistStreamInit_GetSizeMax
,
877 PersistStreamInit_InitNew
880 HRESULT WINAPI
WMPFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
,
881 REFIID riid
, void **ppv
)
883 WindowsMediaPlayer
*wmp
;
888 TRACE("(%p %s %p)\n", outer
, debugstr_guid(riid
), ppv
);
890 wmp
= heap_alloc_zero(sizeof(*wmp
));
892 return E_OUTOFMEMORY
;
894 wmp
->IOleObject_iface
.lpVtbl
= &OleObjectVtbl
;
895 wmp
->IProvideClassInfo2_iface
.lpVtbl
= &ProvideClassInfo2Vtbl
;
896 wmp
->IPersistStreamInit_iface
.lpVtbl
= &PersistStreamInitVtbl
;
897 wmp
->IOleInPlaceObjectWindowless_iface
.lpVtbl
= &OleInPlaceObjectWindowlessVtbl
;
898 wmp
->IOleControl_iface
.lpVtbl
= &OleControlVtbl
;
904 ConnectionPointContainer_Init(wmp
);
906 dpi_x
= GetDeviceCaps(hdc
, LOGPIXELSX
);
907 dpi_y
= GetDeviceCaps(hdc
, LOGPIXELSY
);
910 wmp
->extent
.cx
= MulDiv(192, 2540, dpi_x
);
911 wmp
->extent
.cy
= MulDiv(192, 2540, dpi_y
);
913 hres
= IOleObject_QueryInterface(&wmp
->IOleObject_iface
, riid
, ppv
);
914 IOleObject_Release(&wmp
->IOleObject_iface
);