sdbinst: New stub program.
[wine/multimedia.git] / dlls / wmp / oleobj.c
blobcbf1eae222b8e24e22a951312155a54f27fcc293
1 /*
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"
20 #include "olectl.h"
22 #include "wine/debug.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(wmp);
26 static HWND get_container_hwnd(WindowsMediaPlayer *This)
28 IOleWindow *ole_window;
29 HWND hwnd = NULL;
30 HRESULT hres;
32 /* IOleInPlaceSite (which inherits from IOleWindow) is prefered. */
33 hres = IOleClientSite_QueryInterface(This->client_site, &IID_IOleInPlaceSite, (void**)&ole_window);
34 if(FAILED(hres)) {
35 hres = IOleClientSite_QueryInterface(This->client_site, &IID_IOleWindow, (void**)&ole_window);
36 if(FAILED(hres)) {
37 IOleContainer *container = NULL;
39 hres = IOleClientSite_GetContainer(This->client_site, &container);
40 if(SUCCEEDED(hres)) {
41 hres = IOleContainer_QueryInterface(container, &IID_IOleWindow, (void**)&ole_window);
42 IOleContainer_Release(container);
47 if(FAILED(hres))
48 return NULL;
50 hres = IOleWindow_GetWindow(ole_window, &hwnd);
51 IOleWindow_Release(ole_window);
52 if(FAILED(hres))
53 return NULL;
55 TRACE("Got window %p\n", hwnd);
56 return hwnd;
59 static LRESULT WINAPI wmp_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
61 switch(msg) {
62 case WM_PAINT: {
63 PAINTSTRUCT ps;
64 HFONT font;
65 RECT rect;
66 HDC hdc;
68 TRACE("WM_PAINT\n");
70 GetClientRect(hwnd, &rect);
71 hdc = BeginPaint(hwnd, &ps);
73 SelectObject(hdc, GetStockObject(DC_BRUSH));
74 SetDCBrushColor(hdc, RGB(255,0,0));
75 SetBkColor(hdc, RGB(255,0,0));
77 font = CreateFontA(25,0,0,0,400,0,0,0,ANSI_CHARSET,0,0,DEFAULT_QUALITY,DEFAULT_PITCH,NULL);
78 SelectObject(hdc, font);
80 Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
81 DrawTextA(hdc, "FIXME: WMP", -1, &rect, DT_CENTER | DT_SINGLELINE | DT_VCENTER);
83 DeleteObject(font);
84 EndPaint(hwnd, &ps);
85 break;
89 return DefWindowProcW(hwnd, msg, wParam, lParam);
93 static ATOM wmp_class;
95 static BOOL WINAPI register_wmp_class(INIT_ONCE *once, void *param, void **context)
97 /* It seems that native uses ATL for this. We use a fake name to make tests happy. */
98 static const WCHAR atl_wmpW[] = {'A','T','L',':','W','M','P',0};
100 static WNDCLASSEXW wndclass = {
101 sizeof(wndclass), CS_DBLCLKS, wmp_wnd_proc, 0, 0,
102 NULL, NULL, NULL, NULL, NULL,
103 atl_wmpW, NULL
106 wndclass.hInstance = wmp_instance;
107 wmp_class = RegisterClassExW(&wndclass);
108 return TRUE;
111 void unregister_wmp_class(void)
113 if(wmp_class)
114 UnregisterClassW(MAKEINTRESOURCEW(wmp_class), wmp_instance);
117 static HWND create_wmp_window(WindowsMediaPlayer *wmp, const RECT *posrect)
119 static INIT_ONCE class_init_once = INIT_ONCE_STATIC_INIT;
121 InitOnceExecuteOnce(&class_init_once, register_wmp_class, NULL, NULL);
122 if(!wmp_class)
123 return NULL;
125 return CreateWindowExW(0, MAKEINTRESOURCEW(wmp_class), NULL, WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_VISIBLE|WS_CHILD,
126 posrect->left, posrect->top, posrect->right-posrect->left, posrect->bottom-posrect->top,
127 get_container_hwnd(wmp), NULL, wmp_instance, NULL);
130 static HRESULT activate_inplace(WindowsMediaPlayer *This)
132 IOleInPlaceSiteWindowless *ipsite_windowless;
133 IOleInPlaceSiteEx *ipsiteex = NULL;
134 IOleInPlaceSite *ipsite;
135 IOleInPlaceUIWindow *ip_window = NULL;
136 IOleInPlaceFrame *ip_frame = NULL;
137 RECT posrect = {0}, cliprect = {0};
138 OLEINPLACEFRAMEINFO frameinfo = { sizeof(frameinfo) };
139 HRESULT hres;
141 if(This->hwnd) {
142 FIXME("Already activated\n");
143 return E_UNEXPECTED;
146 hres = IOleClientSite_QueryInterface(This->client_site, &IID_IOleInPlaceSiteWindowless, (void**)&ipsite_windowless);
147 if(SUCCEEDED(hres)) {
148 hres = IOleInPlaceSiteWindowless_CanWindowlessActivate(ipsite_windowless);
149 IOleInPlaceSiteWindowless_Release(ipsite_windowless);
150 if(hres == S_OK)
151 FIXME("Windowless activation not supported\n");
152 ipsiteex = (IOleInPlaceSiteEx*)ipsite_windowless;
153 }else {
154 IOleClientSite_QueryInterface(This->client_site, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex);
157 if(ipsiteex) {
158 BOOL redraw = FALSE; /* Not really used. */
159 IOleInPlaceSiteEx_OnInPlaceActivateEx(ipsiteex, &redraw, 0);
160 ipsite = (IOleInPlaceSite*)ipsiteex;
161 }else {
162 IOleClientSite_QueryInterface(This->client_site, &IID_IOleInPlaceSite, (void**)&ipsite);
163 if(FAILED(hres)) {
164 FIXME("No IOleInPlaceSite instance\n");
165 return hres;
168 IOleInPlaceSite_OnInPlaceActivate(ipsite);
171 hres = IOleInPlaceSite_GetWindowContext(ipsite, &ip_frame, &ip_window, &posrect, &cliprect, &frameinfo);
172 IOleInPlaceSite_Release(ipsite);
173 if(FAILED(hres)) {
174 FIXME("GetWindowContext failed: %08x\n", hres);
175 return hres;
178 This->hwnd = create_wmp_window(This, &posrect);
179 if(!This->hwnd)
180 return E_FAIL;
182 IOleClientSite_ShowObject(This->client_site);
183 return S_OK;
186 static void deactivate_window(WindowsMediaPlayer *This)
188 IOleInPlaceSite *ip_site;
189 HRESULT hres;
191 hres = IOleClientSite_QueryInterface(This->client_site, &IID_IOleInPlaceSite, (void**)&ip_site);
192 if(SUCCEEDED(hres)) {
193 IOleInPlaceSite_OnInPlaceDeactivate(ip_site);
194 IOleInPlaceSite_Release(ip_site);
197 DestroyWindow(This->hwnd);
198 This->hwnd = NULL;
201 static void release_client_site(WindowsMediaPlayer *This)
203 if(!This->client_site)
204 return;
206 if(This->hwnd)
207 deactivate_window(This);
209 IOleClientSite_Release(This->client_site);
210 This->client_site = NULL;
213 static inline WindowsMediaPlayer *impl_from_IOleObject(IOleObject *iface)
215 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IOleObject_iface);
218 static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppv)
220 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
222 if(IsEqualGUID(riid, &IID_IUnknown)) {
223 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
224 *ppv = &This->IOleObject_iface;
225 }else if(IsEqualGUID(riid, &IID_IOleObject)) {
226 TRACE("(%p)->(IID_IOleObject %p)\n", This, ppv);
227 *ppv = &This->IOleObject_iface;
228 }else if(IsEqualGUID(riid, &IID_IProvideClassInfo)) {
229 TRACE("(%p)->(IID_IProvideClassInfo %p)\n", This, ppv);
230 *ppv = &This->IProvideClassInfo2_iface;
231 }else if(IsEqualGUID(riid, &IID_IProvideClassInfo2)) {
232 TRACE("(%p)->(IID_IProvideClassInfo2 %p)\n", This, ppv);
233 *ppv = &This->IProvideClassInfo2_iface;
234 }else if(IsEqualGUID(riid, &IID_IPersist)) {
235 TRACE("(%p)->(IID_IPersist %p)\n", This, ppv);
236 *ppv = &This->IPersistStreamInit_iface;
237 }else if(IsEqualGUID(riid, &IID_IPersistStreamInit)) {
238 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
239 *ppv = &This->IPersistStreamInit_iface;
240 }else if(IsEqualGUID(riid, &IID_IOleWindow)) {
241 TRACE("(%p)->(IID_IOleWindow %p)\n", This, ppv);
242 *ppv = &This->IOleInPlaceObjectWindowless_iface;
243 }else if(IsEqualGUID(riid, &IID_IOleInPlaceObject)) {
244 TRACE("(%p)->(IID_IOleInPlaceObject %p)\n", This, ppv);
245 *ppv = &This->IOleInPlaceObjectWindowless_iface;
246 }else if(IsEqualGUID(riid, &IID_IOleInPlaceObjectWindowless)) {
247 TRACE("(%p)->(IID_IOleInPlaceObjectWindowless %p)\n", This, ppv);
248 *ppv = &This->IOleInPlaceObjectWindowless_iface;
249 }else if(IsEqualGUID(riid, &IID_IConnectionPointContainer)) {
250 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
251 *ppv = &This->IConnectionPointContainer_iface;
252 }else if(IsEqualGUID(riid, &IID_IWMPCore)) {
253 TRACE("(%p)->(IID_IWMPCore %p)\n", This, ppv);
254 *ppv = &This->IWMPPlayer4_iface;
255 }else if(IsEqualGUID(riid, &IID_IWMPCore2)) {
256 TRACE("(%p)->(IID_IWMPCore2 %p)\n", This, ppv);
257 *ppv = &This->IWMPPlayer4_iface;
258 }else if(IsEqualGUID(riid, &IID_IWMPCore3)) {
259 TRACE("(%p)->(IID_IWMPCore3 %p)\n", This, ppv);
260 *ppv = &This->IWMPPlayer4_iface;
261 }else if(IsEqualGUID(riid, &IID_IWMPPlayer4)) {
262 TRACE("(%p)->(IID_IWMPPlayer4 %p)\n", This, ppv);
263 *ppv = &This->IWMPPlayer4_iface;
264 }else if(IsEqualGUID(riid, &IID_IWMPSettings)) {
265 TRACE("(%p)->(IID_IWMPSettings %p)\n", This, ppv);
266 *ppv = &This->IWMPSettings_iface;
267 }else if(IsEqualGUID(riid, &IID_IOleControl)) {
268 TRACE("(%p)->(IID_IOleControl %p)\n", This, ppv);
269 *ppv = &This->IOleControl_iface;
270 }else {
271 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
272 *ppv = NULL;
273 return E_NOINTERFACE;
276 IUnknown_AddRef((IUnknown*)*ppv);
277 return S_OK;
280 static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
282 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
283 LONG ref = InterlockedIncrement(&This->ref);
285 TRACE("(%p) ref=%d\n", This, ref);
287 return ref;
290 static ULONG WINAPI OleObject_Release(IOleObject *iface)
292 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
293 LONG ref = InterlockedDecrement(&This->ref);
295 TRACE("(%p) ref=%d\n", This, ref);
297 if(!ref) {
298 release_client_site(This);
299 heap_free(This);
302 return ref;
305 static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite)
307 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
308 IOleControlSite *control_site;
309 HRESULT hres;
311 TRACE("(%p)->(%p)\n", This, pClientSite);
313 release_client_site(This);
314 if(!pClientSite)
315 return S_OK;
317 IOleClientSite_AddRef(pClientSite);
318 This->client_site = pClientSite;
320 hres = IOleClientSite_QueryInterface(pClientSite, &IID_IOleControlSite, (void**)&control_site);
321 if(SUCCEEDED(hres)) {
322 IDispatch *disp;
324 hres = IOleControlSite_GetExtendedControl(control_site, &disp);
325 if(SUCCEEDED(hres) && disp) {
326 FIXME("Use extended control\n");
327 IDispatch_Release(disp);
330 IOleControlSite_Release(control_site);
333 return S_OK;
336 static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite **ppClientSite)
338 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
340 TRACE("(%p)->(%p)\n", This, ppClientSite);
342 *ppClientSite = This->client_site;
343 return This->client_site ? S_OK : E_FAIL;
346 static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
348 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
349 FIXME("(%p)->(%s %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
350 return E_NOTIMPL;
353 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
355 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
357 TRACE("(%p)->(%08x)\n", This, dwSaveOption);
359 if(dwSaveOption)
360 FIXME("Unsupported option %d\n", dwSaveOption);
362 if(This->hwnd) /* FIXME: Possibly hide window */
363 deactivate_window(This);
364 return S_OK;
367 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker *pmk)
369 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
370 FIXME("(%p %d %p)->()\n", This, dwWhichMoniker, pmk);
371 return E_NOTIMPL;
374 static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
376 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
377 FIXME("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
378 return E_NOTIMPL;
381 static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, IDataObject *pDataObject, BOOL fCreation,
382 DWORD dwReserved)
384 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
385 FIXME("(%p)->(%p %x %d)\n", This, pDataObject, fCreation, dwReserved);
386 return E_NOTIMPL;
389 static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved, IDataObject **ppDataObject)
391 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
392 FIXME("(%p)->(%d %p)\n", This, dwReserved, ppDataObject);
393 return E_NOTIMPL;
396 static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite,
397 LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
399 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
401 switch(iVerb) {
402 case OLEIVERB_INPLACEACTIVATE:
403 TRACE("(%p)->(OLEIVERB_INPLACEACTIVATE)\n", This);
404 return activate_inplace(This);
406 case OLEIVERB_HIDE:
407 if(!This->hwnd) {
408 FIXME("No window to hide\n");
409 return E_UNEXPECTED;
412 ShowWindow(This->hwnd, SW_HIDE);
413 return S_OK;
415 default:
416 FIXME("Unsupported iVerb %d\n", iVerb);
419 return E_NOTIMPL;
422 static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
424 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
425 FIXME("(%p)->(%p)\n", This, ppEnumOleVerb);
426 return E_NOTIMPL;
429 static HRESULT WINAPI OleObject_Update(IOleObject *iface)
431 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
432 FIXME("(%p)\n", This);
433 return E_NOTIMPL;
436 static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface)
438 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
439 FIXME("(%p)\n", This);
440 return E_NOTIMPL;
443 static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID *pClsid)
445 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
446 FIXME("(%p)->(%p)\n", This, pClsid);
447 return E_NOTIMPL;
450 static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType, LPOLESTR *pszUserType)
452 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
453 FIXME("(%p)->(%d %p)\n", This, dwFormOfType, pszUserType);
454 return E_NOTIMPL;
457 static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
459 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
460 FIXME("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
461 return E_NOTIMPL;
464 static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
466 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
467 FIXME("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
468 return E_NOTIMPL;
471 static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink, DWORD *pdwConnection)
473 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
474 FIXME("(%p)->(%p %p)\n", This, pAdvSink, pdwConnection);
475 return E_NOTIMPL;
478 static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
480 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
481 FIXME("(%p)->(%d)\n", This, dwConnection);
482 return E_NOTIMPL;
485 static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
487 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
488 FIXME("(%p)->(%p)\n", This, ppenumAdvise);
489 return E_NOTIMPL;
492 static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
494 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
496 TRACE("(%p)->(%d %p)\n", This, dwAspect, pdwStatus);
498 switch(dwAspect) {
499 case DVASPECT_CONTENT:
500 *pdwStatus = OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|OLEMISC_INSIDEOUT
501 |OLEMISC_CANTLINKINSIDE|OLEMISC_RECOMPOSEONRESIZE;
502 break;
503 default:
504 FIXME("Unhandled aspect %d\n", dwAspect);
505 return E_NOTIMPL;
508 return S_OK;
511 static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE *pLogpal)
513 WindowsMediaPlayer *This = impl_from_IOleObject(iface);
514 FIXME("(%p)->(%p)\n", This, pLogpal);
515 return E_NOTIMPL;
518 static const IOleObjectVtbl OleObjectVtbl = {
519 OleObject_QueryInterface,
520 OleObject_AddRef,
521 OleObject_Release,
522 OleObject_SetClientSite,
523 OleObject_GetClientSite,
524 OleObject_SetHostNames,
525 OleObject_Close,
526 OleObject_SetMoniker,
527 OleObject_GetMoniker,
528 OleObject_InitFromData,
529 OleObject_GetClipboardData,
530 OleObject_DoVerb,
531 OleObject_EnumVerbs,
532 OleObject_Update,
533 OleObject_IsUpToDate,
534 OleObject_GetUserClassID,
535 OleObject_GetUserType,
536 OleObject_SetExtent,
537 OleObject_GetExtent,
538 OleObject_Advise,
539 OleObject_Unadvise,
540 OleObject_EnumAdvise,
541 OleObject_GetMiscStatus,
542 OleObject_SetColorScheme
545 static inline WindowsMediaPlayer *impl_from_IOleInPlaceObjectWindowless(IOleInPlaceObjectWindowless *iface)
547 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IOleInPlaceObjectWindowless_iface);
550 static HRESULT WINAPI OleInPlaceObjectWindowless_QueryInterface(IOleInPlaceObjectWindowless *iface,
551 REFIID riid, void **ppv)
553 WindowsMediaPlayer *This = impl_from_IOleInPlaceObjectWindowless(iface);
554 return IOleObject_QueryInterface(&This->IOleObject_iface, riid, ppv);
557 static ULONG WINAPI OleInPlaceObjectWindowless_AddRef(IOleInPlaceObjectWindowless *iface)
559 WindowsMediaPlayer *This = impl_from_IOleInPlaceObjectWindowless(iface);
560 return IOleObject_AddRef(&This->IOleObject_iface);
563 static ULONG WINAPI OleInPlaceObjectWindowless_Release(IOleInPlaceObjectWindowless *iface)
565 WindowsMediaPlayer *This = impl_from_IOleInPlaceObjectWindowless(iface);
566 return IOleObject_Release(&This->IOleObject_iface);
569 static HRESULT WINAPI OleInPlaceObjectWindowless_GetWindow(IOleInPlaceObjectWindowless *iface, HWND *phwnd)
571 WindowsMediaPlayer *This = impl_from_IOleInPlaceObjectWindowless(iface);
573 TRACE("(%p)->(%p)\n", This, phwnd);
575 *phwnd = This->hwnd;
576 return This->hwnd ? S_OK : E_UNEXPECTED;
579 static HRESULT WINAPI OleInPlaceObjectWindowless_ContextSensitiveHelp(IOleInPlaceObjectWindowless *iface,
580 BOOL fEnterMode)
582 WindowsMediaPlayer *This = impl_from_IOleInPlaceObjectWindowless(iface);
583 FIXME("(%p)->(%x)\n", This, fEnterMode);
584 return E_NOTIMPL;
587 static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless *iface)
589 WindowsMediaPlayer *This = impl_from_IOleInPlaceObjectWindowless(iface);
590 FIXME("(%p)\n", This);
591 return E_NOTIMPL;
594 static HRESULT WINAPI OleInPlaceObjectWindowless_UIDeactivate(IOleInPlaceObjectWindowless *iface)
596 WindowsMediaPlayer *This = impl_from_IOleInPlaceObjectWindowless(iface);
597 FIXME("(%p)\n", This);
598 return E_NOTIMPL;
601 static HRESULT WINAPI OleInPlaceObjectWindowless_SetObjectRects(IOleInPlaceObjectWindowless *iface,
602 LPCRECT lprcPosRect, LPCRECT lprcClipRect)
604 WindowsMediaPlayer *This = impl_from_IOleInPlaceObjectWindowless(iface);
606 TRACE("(%p)->(%s %s)\n", This, wine_dbgstr_rect(lprcPosRect), wine_dbgstr_rect(lprcClipRect));
608 if(This->hwnd) {
609 SetWindowPos(This->hwnd, NULL, lprcPosRect->left, lprcPosRect->top,
610 lprcPosRect->right-lprcPosRect->left, lprcPosRect->bottom-lprcPosRect->top,
611 SWP_NOZORDER | SWP_NOACTIVATE);
614 return S_OK;
617 static HRESULT WINAPI OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless *iface)
619 WindowsMediaPlayer *This = impl_from_IOleInPlaceObjectWindowless(iface);
620 FIXME("(%p)\n", This);
621 return E_NOTIMPL;
624 static HRESULT WINAPI OleInPlaceObjectWindowless_OnWindowMessage(IOleInPlaceObjectWindowless *iface,
625 UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *lpResult)
627 WindowsMediaPlayer *This = impl_from_IOleInPlaceObjectWindowless(iface);
628 FIXME("(%p)->(%u %lu %lu %p)\n", This, msg, wParam, lParam, lpResult);
629 return E_NOTIMPL;
632 static HRESULT WINAPI OleInPlaceObjectWindowless_GetDropTarget(IOleInPlaceObjectWindowless *iface,
633 IDropTarget **ppDropTarget)
635 WindowsMediaPlayer *This = impl_from_IOleInPlaceObjectWindowless(iface);
636 FIXME("(%p)->(%p)\n", This, ppDropTarget);
637 return E_NOTIMPL;
640 static const IOleInPlaceObjectWindowlessVtbl OleInPlaceObjectWindowlessVtbl = {
641 OleInPlaceObjectWindowless_QueryInterface,
642 OleInPlaceObjectWindowless_AddRef,
643 OleInPlaceObjectWindowless_Release,
644 OleInPlaceObjectWindowless_GetWindow,
645 OleInPlaceObjectWindowless_ContextSensitiveHelp,
646 OleInPlaceObjectWindowless_InPlaceDeactivate,
647 OleInPlaceObjectWindowless_UIDeactivate,
648 OleInPlaceObjectWindowless_SetObjectRects,
649 OleInPlaceObjectWindowless_ReactivateAndUndo,
650 OleInPlaceObjectWindowless_OnWindowMessage,
651 OleInPlaceObjectWindowless_GetDropTarget
654 static inline WindowsMediaPlayer *impl_from_IOleControl(IOleControl *iface)
656 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IOleControl_iface);
659 static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface, REFIID riid, void **ppv)
661 WindowsMediaPlayer *This = impl_from_IOleControl(iface);
662 return IOleObject_QueryInterface(&This->IOleObject_iface, riid, ppv);
665 static ULONG WINAPI OleControl_AddRef(IOleControl *iface)
667 WindowsMediaPlayer *This = impl_from_IOleControl(iface);
668 return IOleObject_AddRef(&This->IOleObject_iface);
671 static ULONG WINAPI OleControl_Release(IOleControl *iface)
673 WindowsMediaPlayer *This = impl_from_IOleControl(iface);
674 return IOleObject_AddRef(&This->IOleObject_iface);
677 static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, CONTROLINFO *pCI)
679 WindowsMediaPlayer *This = impl_from_IOleControl(iface);
680 FIXME("(%p)->(%p)\n", This, pCI);
681 return E_NOTIMPL;
684 static HRESULT WINAPI OleControl_OnMnemonic(IOleControl *iface, MSG *msg)
686 WindowsMediaPlayer *This = impl_from_IOleControl(iface);
687 FIXME("(%p)->(%p)\n", This, msg);
688 return E_NOTIMPL;
691 static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID)
693 WindowsMediaPlayer *This = impl_from_IOleControl(iface);
694 FIXME("(%p)->(%d)\n", This, dispID);
695 return E_NOTIMPL;
698 static HRESULT WINAPI OleControl_FreezeEvents(IOleControl *iface, BOOL freeze)
700 WindowsMediaPlayer *This = impl_from_IOleControl(iface);
701 FIXME("(%p)->(%x)\n", This, freeze);
702 return E_NOTIMPL;
705 static const IOleControlVtbl OleControlVtbl = {
706 OleControl_QueryInterface,
707 OleControl_AddRef,
708 OleControl_Release,
709 OleControl_GetControlInfo,
710 OleControl_OnMnemonic,
711 OleControl_OnAmbientPropertyChange,
712 OleControl_FreezeEvents
715 static inline WindowsMediaPlayer *impl_from_IProvideClassInfo2(IProvideClassInfo2 *iface)
717 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IProvideClassInfo2_iface);
720 static HRESULT WINAPI ProvideClassInfo2_QueryInterface(IProvideClassInfo2 *iface, REFIID riid, void **ppv)
722 WindowsMediaPlayer *This = impl_from_IProvideClassInfo2(iface);
723 return IOleObject_QueryInterface(&This->IOleObject_iface, riid, ppv);
726 static ULONG WINAPI ProvideClassInfo2_AddRef(IProvideClassInfo2 *iface)
728 WindowsMediaPlayer *This = impl_from_IProvideClassInfo2(iface);
729 return IOleObject_AddRef(&This->IOleObject_iface);
732 static ULONG WINAPI ProvideClassInfo2_Release(IProvideClassInfo2 *iface)
734 WindowsMediaPlayer *This = impl_from_IProvideClassInfo2(iface);
735 return IOleObject_Release(&This->IOleObject_iface);
738 static HRESULT WINAPI ProvideClassInfo2_GetClassInfo(IProvideClassInfo2 *iface, ITypeInfo **ppTI)
740 WindowsMediaPlayer *This = impl_from_IProvideClassInfo2(iface);
741 FIXME("(%p)->(%p)\n", This, ppTI);
742 return E_NOTIMPL;
745 static HRESULT WINAPI ProvideClassInfo2_GetGUID(IProvideClassInfo2 *iface, DWORD dwGuidKind, GUID *pGUID)
747 WindowsMediaPlayer *This = impl_from_IProvideClassInfo2(iface);
749 TRACE("(%p)->(%d %p)\n", This, dwGuidKind, pGUID);
751 if(dwGuidKind != GUIDKIND_DEFAULT_SOURCE_DISP_IID) {
752 FIXME("Unexpected dwGuidKind %d\n", dwGuidKind);
753 return E_INVALIDARG;
756 *pGUID = IID__WMPOCXEvents;
757 return S_OK;
760 static const IProvideClassInfo2Vtbl ProvideClassInfo2Vtbl = {
761 ProvideClassInfo2_QueryInterface,
762 ProvideClassInfo2_AddRef,
763 ProvideClassInfo2_Release,
764 ProvideClassInfo2_GetClassInfo,
765 ProvideClassInfo2_GetGUID
768 static inline WindowsMediaPlayer *impl_from_IPersistStreamInit(IPersistStreamInit *iface)
770 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IPersistStreamInit_iface);
773 static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface,
774 REFIID riid, void **ppv)
776 WindowsMediaPlayer *This = impl_from_IPersistStreamInit(iface);
777 return IOleObject_QueryInterface(&This->IOleObject_iface, riid, ppv);
780 static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
782 WindowsMediaPlayer *This = impl_from_IPersistStreamInit(iface);
783 return IOleObject_AddRef(&This->IOleObject_iface);
786 static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
788 WindowsMediaPlayer *This = impl_from_IPersistStreamInit(iface);
789 return IOleObject_Release(&This->IOleObject_iface);
792 static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *pClassID)
794 WindowsMediaPlayer *This = impl_from_IPersistStreamInit(iface);
795 FIXME("(%p)->(%p)\n", This, pClassID);
796 return E_NOTIMPL;
799 static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
801 WindowsMediaPlayer *This = impl_from_IPersistStreamInit(iface);
802 FIXME("(%p)\n", This);
803 return E_NOTIMPL;
806 static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM pStm)
808 WindowsMediaPlayer *This = impl_from_IPersistStreamInit(iface);
809 FIXME("(%p)->(%p)\n", This, pStm);
810 return E_NOTIMPL;
813 static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStm,
814 BOOL fClearDirty)
816 WindowsMediaPlayer *This = impl_from_IPersistStreamInit(iface);
817 FIXME("(%p)->(%p %x)\n", This, pStm, fClearDirty);
818 return E_NOTIMPL;
821 static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface,
822 ULARGE_INTEGER *pcbSize)
824 WindowsMediaPlayer *This = impl_from_IPersistStreamInit(iface);
825 FIXME("(%p)->(%p)\n", This, pcbSize);
826 return E_NOTIMPL;
829 static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
831 WindowsMediaPlayer *This = impl_from_IPersistStreamInit(iface);
833 TRACE("(%p)\n", This);
835 if(!This->client_site)
836 return E_FAIL;
838 /* Nothing to do, yet. */
839 get_container_hwnd(This);
840 return S_OK;
843 static const IPersistStreamInitVtbl PersistStreamInitVtbl = {
844 PersistStreamInit_QueryInterface,
845 PersistStreamInit_AddRef,
846 PersistStreamInit_Release,
847 PersistStreamInit_GetClassID,
848 PersistStreamInit_IsDirty,
849 PersistStreamInit_Load,
850 PersistStreamInit_Save,
851 PersistStreamInit_GetSizeMax,
852 PersistStreamInit_InitNew
855 static inline WindowsMediaPlayer *impl_from_IConnectionPointContainer(IConnectionPointContainer *iface)
857 return CONTAINING_RECORD(iface, WindowsMediaPlayer, IConnectionPointContainer_iface);
860 static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface,
861 REFIID riid, LPVOID *ppv)
863 WindowsMediaPlayer *This = impl_from_IConnectionPointContainer(iface);
864 return IOleObject_QueryInterface(&This->IOleObject_iface, riid, ppv);
867 static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
869 WindowsMediaPlayer *This = impl_from_IConnectionPointContainer(iface);
870 return IOleObject_AddRef(&This->IOleObject_iface);
873 static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
875 WindowsMediaPlayer *This = impl_from_IConnectionPointContainer(iface);
876 return IOleObject_Release(&This->IOleObject_iface);
879 static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface,
880 IEnumConnectionPoints **ppEnum)
882 WindowsMediaPlayer *This = impl_from_IConnectionPointContainer(iface);
883 FIXME("(%p)->(%p)\n", This, ppEnum);
884 return E_NOTIMPL;
887 static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface,
888 REFIID riid, IConnectionPoint **ppCP)
890 WindowsMediaPlayer *This = impl_from_IConnectionPointContainer(iface);
891 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppCP);
892 return CONNECT_E_NOCONNECTION;
895 static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl =
897 ConnectionPointContainer_QueryInterface,
898 ConnectionPointContainer_AddRef,
899 ConnectionPointContainer_Release,
900 ConnectionPointContainer_EnumConnectionPoints,
901 ConnectionPointContainer_FindConnectionPoint
904 HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory *iface, IUnknown *outer,
905 REFIID riid, void **ppv)
907 WindowsMediaPlayer *wmp;
908 HRESULT hres;
910 TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
912 wmp = heap_alloc_zero(sizeof(*wmp));
913 if(!wmp)
914 return E_OUTOFMEMORY;
916 wmp->IOleObject_iface.lpVtbl = &OleObjectVtbl;
917 wmp->IProvideClassInfo2_iface.lpVtbl = &ProvideClassInfo2Vtbl;
918 wmp->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl;
919 wmp->IOleInPlaceObjectWindowless_iface.lpVtbl = &OleInPlaceObjectWindowlessVtbl;
920 wmp->IConnectionPointContainer_iface.lpVtbl = &ConnectionPointContainerVtbl;
921 wmp->IOleControl_iface.lpVtbl = &OleControlVtbl;
923 wmp->ref = 1;
925 init_player_ifaces(wmp);
927 hres = IOleObject_QueryInterface(&wmp->IOleObject_iface, riid, ppv);
928 IOleObject_Release(&wmp->IOleObject_iface);
929 return hres;