gdiplus: Implement GdipSetPathGradientBlend, with tests.
[wine/multimedia.git] / dlls / strmbase / window.c
blobffb04251351fa6c26a99208b17b82a5b93495e19
1 /*
2 * Generic Implementation of strmbase window classes
4 * Copyright 2012 Aric Stewart, CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define COBJMACROS
23 #include "dshow.h"
24 #include "wine/debug.h"
25 #include "wine/unicode.h"
26 #include "wine/strmbase.h"
27 #include "uuids.h"
28 #include "vfwmsgs.h"
29 #include <assert.h>
31 WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
33 static inline BaseControlWindow *impl_from_IVideoWindow( IVideoWindow *iface)
35 return CONTAINING_RECORD(iface, BaseControlWindow, IVideoWindow_iface);
38 static inline BaseControlWindow *impl_from_BaseWindow(BaseWindow *iface)
40 return CONTAINING_RECORD(iface, BaseControlWindow, baseWindow);
43 static LRESULT CALLBACK WndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
45 BaseWindow* This = (BaseWindow*)GetWindowLongPtrW(hwnd, 0);
47 if (!This)
48 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
50 if (This->pFuncsTable->pfnOnReceiveMessage)
51 return This->pFuncsTable->pfnOnReceiveMessage(This, hwnd, uMsg, wParam, lParam);
52 else
53 return BaseWindowImpl_OnReceiveMessage(This, hwnd, uMsg, wParam, lParam);
56 LRESULT WINAPI BaseWindowImpl_OnReceiveMessage(BaseWindow *This, HWND hwnd, INT uMsg, WPARAM wParam, LPARAM lParam)
58 if (This->pFuncsTable->pfnPossiblyEatMessage && This->pFuncsTable->pfnPossiblyEatMessage(This, uMsg, wParam, lParam))
59 return 0;
61 switch (uMsg)
63 case WM_SIZE:
64 if (This->pFuncsTable->pfnOnSize)
65 return This->pFuncsTable->pfnOnSize(This, LOWORD(lParam), HIWORD(lParam));
66 else
67 return BaseWindowImpl_OnSize(This, LOWORD(lParam), HIWORD(lParam));
70 return DefWindowProcW(hwnd, uMsg, wParam, lParam);
73 BOOL WINAPI BaseWindowImpl_OnSize(BaseWindow *This, LONG Width, LONG Height)
75 This->Width = Width;
76 This->Height = Height;
77 return TRUE;
80 HRESULT WINAPI BaseWindow_Init(BaseWindow *pBaseWindow, const BaseWindowFuncTable* pFuncsTable)
82 if (!pFuncsTable)
83 return E_INVALIDARG;
85 ZeroMemory(pBaseWindow,sizeof(BaseWindow));
86 pBaseWindow->pFuncsTable = pFuncsTable;
88 return S_OK;
91 HRESULT WINAPI BaseWindow_Destroy(BaseWindow *This)
93 if (This->hWnd)
94 BaseWindowImpl_DoneWithWindow(This);
96 HeapFree(GetProcessHeap(), 0, This);
97 return S_OK;
100 HRESULT WINAPI BaseWindowImpl_PrepareWindow(BaseWindow *This)
102 WNDCLASSW winclass;
103 static const WCHAR windownameW[] = { 'A','c','t','i','v','e','M','o','v','i','e',' ','W','i','n','d','o','w',0 };
105 This->pClassName = This->pFuncsTable->pfnGetClassWindowStyles(This, &This->ClassStyles, &This->WindowStyles, &This->WindowStylesEx);
107 winclass.style = This->ClassStyles;
108 winclass.lpfnWndProc = WndProcW;
109 winclass.cbClsExtra = 0;
110 winclass.cbWndExtra = sizeof(BaseWindow*);
111 winclass.hInstance = This->hInstance;
112 winclass.hIcon = NULL;
113 winclass.hCursor = NULL;
114 winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
115 winclass.lpszMenuName = NULL;
116 winclass.lpszClassName = This->pClassName;
117 if (!RegisterClassW(&winclass) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
119 ERR("Unable to register window class: %u\n", GetLastError());
120 return E_FAIL;
123 This->hWnd = CreateWindowExW(This->WindowStylesEx,
124 This->pClassName, windownameW,
125 This->WindowStyles,
126 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
127 CW_USEDEFAULT, NULL, NULL, This->hInstance,
128 NULL);
130 if (!This->hWnd)
132 ERR("Unable to create window\n");
133 return E_FAIL;
136 SetWindowLongPtrW(This->hWnd, 0, (LONG_PTR)This);
138 This->hDC = GetDC(This->hWnd);
140 return S_OK;
143 HRESULT WINAPI BaseWindowImpl_DoneWithWindow(BaseWindow *This)
145 if (!This->hWnd)
146 return S_OK;
148 if (This->hDC)
149 ReleaseDC(This->hWnd, This->hDC);
150 This->hDC = NULL;
152 DestroyWindow(This->hWnd);
153 This->hWnd = NULL;
155 return S_OK;
158 RECT WINAPI BaseWindowImpl_GetDefaultRect(BaseWindow *This)
160 static RECT defRect = {0, 0, 800, 600};
161 return defRect;
164 BOOL WINAPI BaseControlWindowImpl_PossiblyEatMessage(BaseWindow *This, UINT uMsg, WPARAM wParam, LPARAM lParam)
166 BaseControlWindow* pControlWindow = impl_from_BaseWindow(This);
168 if (pControlWindow->hwndDrain)
170 switch(uMsg)
172 case WM_KEYDOWN:
173 case WM_KEYUP:
174 case WM_LBUTTONDBLCLK:
175 case WM_LBUTTONDOWN:
176 case WM_LBUTTONUP:
177 case WM_MBUTTONDBLCLK:
178 case WM_MBUTTONDOWN:
179 case WM_MBUTTONUP:
180 case WM_MOUSEACTIVATE:
181 case WM_MOUSEMOVE:
182 case WM_NCLBUTTONDBLCLK:
183 case WM_NCLBUTTONDOWN:
184 case WM_NCLBUTTONUP:
185 case WM_NCMBUTTONDBLCLK:
186 case WM_NCMBUTTONDOWN:
187 case WM_NCMBUTTONUP:
188 case WM_NCMOUSEMOVE:
189 case WM_NCRBUTTONDBLCLK:
190 case WM_NCRBUTTONDOWN:
191 case WM_NCRBUTTONUP:
192 case WM_RBUTTONDBLCLK:
193 case WM_RBUTTONDOWN:
194 case WM_RBUTTONUP:
195 PostMessageW(pControlWindow->hwndDrain, uMsg, wParam, lParam);
196 return TRUE;
197 default:
198 break;
201 return FALSE;
204 HRESULT WINAPI BaseControlWindow_Init(BaseControlWindow *pControlWindow, const IVideoWindowVtbl *lpVtbl, BaseFilter *owner, CRITICAL_SECTION *lock, BasePin* pPin,const BaseWindowFuncTable *pFuncsTable)
206 HRESULT hr;
208 hr = BaseWindow_Init(&pControlWindow->baseWindow, pFuncsTable);
209 if (SUCCEEDED(hr))
211 BaseDispatch_Init(&pControlWindow->baseDispatch, &IID_IVideoWindow);
212 pControlWindow->IVideoWindow_iface.lpVtbl = lpVtbl;
213 pControlWindow->AutoShow = TRUE;
214 pControlWindow->hwndDrain = NULL;
215 pControlWindow->hwndOwner = NULL;
216 pControlWindow->pFilter = owner;
217 pControlWindow->pInterfaceLock = lock;
218 pControlWindow->pPin = pPin;
220 return hr;
223 HRESULT WINAPI BaseControlWindow_Destroy(BaseControlWindow *pControlWindow)
225 BaseWindowImpl_DoneWithWindow(&pControlWindow->baseWindow);
226 return BaseDispatch_Destroy(&pControlWindow->baseDispatch);
229 HRESULT WINAPI BaseControlWindowImpl_GetTypeInfoCount(IVideoWindow *iface, UINT *pctinfo)
231 BaseControlWindow* This = impl_from_IVideoWindow(iface);
233 return BaseDispatchImpl_GetTypeInfoCount(&This->baseDispatch, pctinfo);
236 HRESULT WINAPI BaseControlWindowImpl_GetTypeInfo(IVideoWindow *iface, UINT iTInfo, LCID lcid, ITypeInfo**ppTInfo)
238 BaseControlWindow* This = impl_from_IVideoWindow(iface);
240 return BaseDispatchImpl_GetTypeInfo(&This->baseDispatch, &IID_NULL, iTInfo, lcid, ppTInfo);
243 HRESULT WINAPI BaseControlWindowImpl_GetIDsOfNames(IVideoWindow *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
245 BaseControlWindow* This = impl_from_IVideoWindow(iface);
247 return BaseDispatchImpl_GetIDsOfNames(&This->baseDispatch, riid, rgszNames, cNames, lcid, rgDispId);
250 HRESULT WINAPI BaseControlWindowImpl_Invoke(IVideoWindow *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExepInfo, UINT *puArgErr)
252 BaseControlWindow* This = impl_from_IVideoWindow(iface);
253 HRESULT hr = S_OK;
254 ITypeInfo *pTypeInfo;
256 hr = BaseDispatchImpl_GetTypeInfo(&This->baseDispatch, riid, 1, lcid, &pTypeInfo);
257 if (SUCCEEDED(hr))
259 hr = ITypeInfo_Invoke(pTypeInfo, &This->IVideoWindow_iface, dispIdMember, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
260 ITypeInfo_Release(pTypeInfo);
263 return hr;
266 HRESULT WINAPI BaseControlWindowImpl_put_Caption(IVideoWindow *iface, BSTR strCaption)
268 BaseControlWindow* This = impl_from_IVideoWindow(iface);
270 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
272 if (!SetWindowTextW(This->baseWindow.hWnd, strCaption))
273 return E_FAIL;
275 return S_OK;
278 HRESULT WINAPI BaseControlWindowImpl_get_Caption(IVideoWindow *iface, BSTR *strCaption)
280 BaseControlWindow* This = impl_from_IVideoWindow(iface);
282 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
284 GetWindowTextW(This->baseWindow.hWnd, (LPWSTR)strCaption, 100);
286 return S_OK;
289 HRESULT WINAPI BaseControlWindowImpl_put_WindowStyle(IVideoWindow *iface, LONG WindowStyle)
291 BaseControlWindow* This = impl_from_IVideoWindow(iface);
292 LONG old;
294 old = GetWindowLongW(This->baseWindow.hWnd, GWL_STYLE);
296 TRACE("(%p/%p)->(%x -> %x)\n", This, iface, old, WindowStyle);
298 if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
299 return E_INVALIDARG;
301 SetWindowLongW(This->baseWindow.hWnd, GWL_STYLE, WindowStyle);
302 SetWindowPos(This->baseWindow.hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
304 return S_OK;
307 HRESULT WINAPI BaseControlWindowImpl_get_WindowStyle(IVideoWindow *iface, LONG *WindowStyle)
309 BaseControlWindow* This = impl_from_IVideoWindow(iface);
311 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
313 *WindowStyle = GetWindowLongW(This->baseWindow.hWnd, GWL_STYLE);
315 return S_OK;
318 HRESULT WINAPI BaseControlWindowImpl_put_WindowStyleEx(IVideoWindow *iface, LONG WindowStyleEx)
320 BaseControlWindow* This = impl_from_IVideoWindow(iface);
322 TRACE("(%p/%p)->(%d)\n", This, iface, WindowStyleEx);
324 if (!SetWindowLongW(This->baseWindow.hWnd, GWL_EXSTYLE, WindowStyleEx))
325 return E_FAIL;
327 return S_OK;
330 HRESULT WINAPI BaseControlWindowImpl_get_WindowStyleEx(IVideoWindow *iface, LONG *WindowStyleEx)
332 BaseControlWindow* This = impl_from_IVideoWindow(iface);
334 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
336 *WindowStyleEx = GetWindowLongW(This->baseWindow.hWnd, GWL_EXSTYLE);
338 return S_OK;
341 HRESULT WINAPI BaseControlWindowImpl_put_AutoShow(IVideoWindow *iface, LONG AutoShow)
343 BaseControlWindow* This = impl_from_IVideoWindow(iface);
345 TRACE("(%p/%p)->(%d)\n", This, iface, AutoShow);
347 This->AutoShow = AutoShow;
349 return S_OK;
352 HRESULT WINAPI BaseControlWindowImpl_get_AutoShow(IVideoWindow *iface, LONG *AutoShow)
354 BaseControlWindow* This = impl_from_IVideoWindow(iface);
356 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
358 *AutoShow = This->AutoShow;
360 return S_OK;
363 HRESULT WINAPI BaseControlWindowImpl_put_WindowState(IVideoWindow *iface, LONG WindowState)
365 BaseControlWindow* This = impl_from_IVideoWindow(iface);
367 TRACE("(%p/%p)->(%d)\n", This, iface, WindowState);
368 ShowWindow(This->baseWindow.hWnd, WindowState);
369 return S_OK;
372 HRESULT WINAPI BaseControlWindowImpl_get_WindowState(IVideoWindow *iface, LONG *WindowState)
374 WINDOWPLACEMENT place;
375 BaseControlWindow* This = impl_from_IVideoWindow(iface);
377 place.length = sizeof(place);
378 GetWindowPlacement(This->baseWindow.hWnd, &place);
379 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
380 *WindowState = place.showCmd;
382 return S_OK;
385 HRESULT WINAPI BaseControlWindowImpl_put_BackgroundPalette(IVideoWindow *iface, LONG BackgroundPalette)
387 BaseControlWindow* This = impl_from_IVideoWindow(iface);
389 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, BackgroundPalette);
391 return S_OK;
394 HRESULT WINAPI BaseControlWindowImpl_get_BackgroundPalette(IVideoWindow *iface, LONG *pBackgroundPalette)
396 BaseControlWindow* This = impl_from_IVideoWindow(iface);
398 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
400 return S_OK;
403 HRESULT WINAPI BaseControlWindowImpl_put_Visible(IVideoWindow *iface, LONG Visible)
405 BaseControlWindow* This = impl_from_IVideoWindow(iface);
407 TRACE("(%p/%p)->(%d)\n", This, iface, Visible);
409 ShowWindow(This->baseWindow.hWnd, Visible ? SW_SHOW : SW_HIDE);
411 return S_OK;
414 HRESULT WINAPI BaseControlWindowImpl_get_Visible(IVideoWindow *iface, LONG *pVisible)
416 BaseControlWindow* This = impl_from_IVideoWindow(iface);
418 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
420 *pVisible = IsWindowVisible(This->baseWindow.hWnd);
422 return S_OK;
425 HRESULT WINAPI BaseControlWindowImpl_put_Left(IVideoWindow *iface, LONG Left)
427 BaseControlWindow* This = impl_from_IVideoWindow(iface);
428 RECT WindowPos;
430 TRACE("(%p/%p)->(%d)\n", This, iface, Left);
432 GetWindowRect(This->baseWindow.hWnd, &WindowPos);
433 if (!SetWindowPos(This->baseWindow.hWnd, NULL, Left, WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
434 return E_FAIL;
436 return S_OK;
439 HRESULT WINAPI BaseControlWindowImpl_get_Left(IVideoWindow *iface, LONG *pLeft)
441 BaseControlWindow* This = impl_from_IVideoWindow(iface);
442 RECT WindowPos;
444 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
445 GetWindowRect(This->baseWindow.hWnd, &WindowPos);
447 *pLeft = WindowPos.left;
449 return S_OK;
452 HRESULT WINAPI BaseControlWindowImpl_put_Width(IVideoWindow *iface, LONG Width)
454 BaseControlWindow* This = impl_from_IVideoWindow(iface);
456 TRACE("(%p/%p)->(%d)\n", This, iface, Width);
458 if (!SetWindowPos(This->baseWindow.hWnd, NULL, 0, 0, Width, This->baseWindow.Height, SWP_NOZORDER|SWP_NOMOVE))
459 return E_FAIL;
461 This->baseWindow.Width = Width;
463 return S_OK;
466 HRESULT WINAPI BaseControlWindowImpl_get_Width(IVideoWindow *iface, LONG *pWidth)
468 BaseControlWindow* This = impl_from_IVideoWindow(iface);
470 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
472 *pWidth = This->baseWindow.Width;
474 return S_OK;
477 HRESULT WINAPI BaseControlWindowImpl_put_Top(IVideoWindow *iface, LONG Top)
479 BaseControlWindow* This = impl_from_IVideoWindow(iface);
480 RECT WindowPos;
482 TRACE("(%p/%p)->(%d)\n", This, iface, Top);
483 GetWindowRect(This->baseWindow.hWnd, &WindowPos);
485 if (!SetWindowPos(This->baseWindow.hWnd, NULL, WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
486 return E_FAIL;
488 return S_OK;
491 HRESULT WINAPI BaseControlWindowImpl_get_Top(IVideoWindow *iface, LONG *pTop)
493 BaseControlWindow* This = impl_from_IVideoWindow(iface);
494 RECT WindowPos;
496 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
497 GetWindowRect(This->baseWindow.hWnd, &WindowPos);
499 *pTop = WindowPos.top;
501 return S_OK;
504 HRESULT WINAPI BaseControlWindowImpl_put_Height(IVideoWindow *iface, LONG Height)
506 BaseControlWindow* This = impl_from_IVideoWindow(iface);
508 TRACE("(%p/%p)->(%d)\n", This, iface, Height);
510 if (!SetWindowPos(This->baseWindow.hWnd, NULL, 0, 0, This->baseWindow.Width, Height, SWP_NOZORDER|SWP_NOMOVE))
511 return E_FAIL;
513 This->baseWindow.Height = Height;
515 return S_OK;
518 HRESULT WINAPI BaseControlWindowImpl_get_Height(IVideoWindow *iface, LONG *pHeight)
520 BaseControlWindow* This = impl_from_IVideoWindow(iface);
522 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
524 *pHeight = This->baseWindow.Height;
526 return S_OK;
529 HRESULT WINAPI BaseControlWindowImpl_put_Owner(IVideoWindow *iface, OAHWND Owner)
531 BaseControlWindow* This = impl_from_IVideoWindow(iface);
533 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
535 This->hwndOwner = (HWND)Owner;
536 SetParent(This->baseWindow.hWnd, This->hwndOwner);
538 return S_OK;
541 HRESULT WINAPI BaseControlWindowImpl_get_Owner(IVideoWindow *iface, OAHWND *Owner)
543 BaseControlWindow* This = impl_from_IVideoWindow(iface);
545 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
547 *(HWND*)Owner = This->hwndOwner;
549 return S_OK;
552 HRESULT WINAPI BaseControlWindowImpl_put_MessageDrain(IVideoWindow *iface, OAHWND Drain)
554 BaseControlWindow* This = impl_from_IVideoWindow(iface);
556 TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
558 This->hwndDrain = (HWND)Drain;
560 return S_OK;
563 HRESULT WINAPI BaseControlWindowImpl_get_MessageDrain(IVideoWindow *iface, OAHWND *Drain)
565 BaseControlWindow* This = impl_from_IVideoWindow(iface);
567 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
569 *Drain = (OAHWND)This->hwndDrain;
571 return S_OK;
574 HRESULT WINAPI BaseControlWindowImpl_get_BorderColor(IVideoWindow *iface, LONG *Color)
576 BaseControlWindow* This = impl_from_IVideoWindow(iface);
578 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
580 return S_OK;
583 HRESULT WINAPI BaseControlWindowImpl_put_BorderColor(IVideoWindow *iface, LONG Color)
585 BaseControlWindow* This = impl_from_IVideoWindow(iface);
587 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, Color);
589 return S_OK;
592 HRESULT WINAPI BaseControlWindowImpl_get_FullScreenMode(IVideoWindow *iface, LONG *FullScreenMode)
594 TRACE("(%p)->(%p)\n", iface, FullScreenMode);
596 return E_NOTIMPL;
599 HRESULT WINAPI BaseControlWindowImpl_put_FullScreenMode(IVideoWindow *iface, LONG FullScreenMode)
601 TRACE("(%p)->(%d)\n", iface, FullScreenMode);
602 return E_NOTIMPL;
605 HRESULT WINAPI BaseControlWindowImpl_SetWindowForeground(IVideoWindow *iface, LONG Focus)
607 BaseControlWindow* This = impl_from_IVideoWindow(iface);
608 BOOL ret;
609 IPin* pPin;
610 HRESULT hr;
612 TRACE("(%p/%p)->(%d)\n", This, iface, Focus);
614 if ((Focus != FALSE) && (Focus != TRUE))
615 return E_INVALIDARG;
617 hr = IPin_ConnectedTo(&This->pPin->IPin_iface, &pPin);
618 if ((hr != S_OK) || !pPin)
619 return VFW_E_NOT_CONNECTED;
621 if (Focus)
622 ret = SetForegroundWindow(This->baseWindow.hWnd);
623 else
624 ret = SetWindowPos(This->baseWindow.hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
626 if (!ret)
627 return E_FAIL;
629 return S_OK;
632 HRESULT WINAPI BaseControlWindowImpl_SetWindowPosition(IVideoWindow *iface, LONG Left, LONG Top, LONG Width, LONG Height)
634 BaseControlWindow* This = impl_from_IVideoWindow(iface);
636 TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
638 if (!SetWindowPos(This->baseWindow.hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
639 return E_FAIL;
641 This->baseWindow.Width = Width;
642 This->baseWindow.Height = Height;
644 return S_OK;
647 HRESULT WINAPI BaseControlWindowImpl_GetWindowPosition(IVideoWindow *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight)
649 BaseControlWindow* This = impl_from_IVideoWindow(iface);
650 RECT WindowPos;
652 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
653 GetWindowRect(This->baseWindow.hWnd, &WindowPos);
655 *pLeft = WindowPos.left;
656 *pTop = WindowPos.top;
657 *pWidth = This->baseWindow.Width;
658 *pHeight = This->baseWindow.Height;
660 return S_OK;
663 HRESULT WINAPI BaseControlWindowImpl_NotifyOwnerMessage(IVideoWindow *iface, OAHWND hwnd, LONG uMsg, LONG_PTR wParam, LONG_PTR lParam)
665 BaseControlWindow* This = impl_from_IVideoWindow(iface);
667 TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This, iface, hwnd, uMsg, wParam, lParam);
669 if (!PostMessageW(This->baseWindow.hWnd, uMsg, wParam, lParam))
670 return E_FAIL;
672 return S_OK;
675 HRESULT WINAPI BaseControlWindowImpl_GetMinIdealImageSize(IVideoWindow *iface, LONG *pWidth, LONG *pHeight)
677 BaseControlWindow* This = impl_from_IVideoWindow(iface);
678 RECT defaultRect;
680 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
681 defaultRect = This->baseWindow.pFuncsTable->pfnGetDefaultRect(&This->baseWindow);
683 *pWidth = defaultRect.right - defaultRect.left;
684 *pHeight = defaultRect.bottom - defaultRect.top;
686 return S_OK;
689 HRESULT WINAPI BaseControlWindowImpl_GetMaxIdealImageSize(IVideoWindow *iface, LONG *pWidth, LONG *pHeight)
691 BaseControlWindow* This = impl_from_IVideoWindow(iface);
692 RECT defaultRect;
694 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
695 defaultRect = This->baseWindow.pFuncsTable->pfnGetDefaultRect(&This->baseWindow);
697 *pWidth = defaultRect.right - defaultRect.left;
698 *pHeight = defaultRect.bottom - defaultRect.top;
700 return S_OK;
703 HRESULT WINAPI BaseControlWindowImpl_GetRestorePosition(IVideoWindow *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight)
705 BaseControlWindow* This = impl_from_IVideoWindow(iface);
707 FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
709 return S_OK;
712 HRESULT WINAPI BaseControlWindowImpl_HideCursor(IVideoWindow *iface, LONG HideCursor)
714 BaseControlWindow* This = impl_from_IVideoWindow(iface);
716 FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, HideCursor);
718 return S_OK;
721 HRESULT WINAPI BaseControlWindowImpl_IsCursorHidden(IVideoWindow *iface, LONG *CursorHidden)
723 BaseControlWindow* This = impl_from_IVideoWindow(iface);
725 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
727 return S_OK;