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 #define WIN32_LEAN_AND_MEAN
29 #include "wine/test.h"
30 #include "wine/heap.h"
32 #define DEFINE_EXPECT(func) \
33 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
35 #define SET_EXPECT(func) \
36 expect_ ## func = TRUE
38 #define CHECK_EXPECT2(func) \
40 ok(expect_ ##func, "unexpected call " #func "\n"); \
41 called_ ## func = TRUE; \
44 #define CHECK_EXPECT(func) \
46 CHECK_EXPECT2(func); \
47 expect_ ## func = FALSE; \
50 #define CHECK_CALLED(func) \
52 ok(called_ ## func, "expected " #func "\n"); \
53 expect_ ## func = called_ ## func = FALSE; \
56 #define CHECK_CALLED_OR_BROKEN(func) \
58 ok(called_ ## func || broken(1), "expected " #func "\n"); \
59 expect_ ## func = called_ ## func = FALSE; \
62 DEFINE_EXPECT(GetContainer
);
63 DEFINE_EXPECT(GetExtendedControl
);
64 DEFINE_EXPECT(GetWindow
);
65 DEFINE_EXPECT(Invoke_USERMODE
);
66 DEFINE_EXPECT(CanWindowlessActivate
);
67 DEFINE_EXPECT(OnInPlaceActivateEx
);
68 DEFINE_EXPECT(OnInPlaceDeactivate
);
69 DEFINE_EXPECT(GetWindowContext
);
70 DEFINE_EXPECT(ShowObject
);
71 DEFINE_EXPECT(OnShowWindow_FALSE
);
73 static const WCHAR mp3file
[] = {'t','e','s','t','.','m','p','3',0};
74 static inline WCHAR
*load_resource(const WCHAR
*name
)
76 static WCHAR pathW
[MAX_PATH
];
82 GetTempPathW(ARRAY_SIZE(pathW
), pathW
);
83 lstrcatW(pathW
, name
);
85 file
= CreateFileW(pathW
, GENERIC_READ
|GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, 0);
86 ok(file
!= INVALID_HANDLE_VALUE
, "file creation failed, at %s, error %d\n", wine_dbgstr_w(pathW
),
89 res
= FindResourceW(NULL
, name
, (LPCWSTR
)RT_RCDATA
);
90 ok( res
!= 0, "couldn't find resource\n" );
91 ptr
= LockResource( LoadResource( GetModuleHandleA(NULL
), res
));
92 WriteFile( file
, ptr
, SizeofResource( GetModuleHandleA(NULL
), res
), &written
, NULL
);
93 ok( written
== SizeofResource( GetModuleHandleA(NULL
), res
), "couldn't write resource\n" );
99 static HWND container_hwnd
;
101 static HRESULT WINAPI
OleContainer_QueryInterface(IOleContainer
*iface
, REFIID riid
, void **ppv
)
103 if(IsEqualGUID(riid
, &IID_IUnknown
)) {
105 }else if(IsEqualGUID(riid
, &IID_IOleContainer
)) {
108 trace("OleContainer QI(%s)\n", wine_dbgstr_guid(riid
));
110 return E_NOINTERFACE
;
116 static ULONG WINAPI
OleContainer_AddRef(IOleContainer
*iface
)
121 static ULONG WINAPI
OleContainer_Release(IOleContainer
*iface
)
126 static HRESULT WINAPI
OleContainer_ParseDisplayName(IOleContainer
*iface
, IBindCtx
*pbc
,
127 LPOLESTR pszDisplayName
, ULONG
*pchEaten
, IMoniker
**ppmkOut
)
129 ok(0, "unexpected call\n");
133 static HRESULT WINAPI
OleContainer_EnumObjects(IOleContainer
*iface
, DWORD grfFlags
,
134 IEnumUnknown
**ppenum
)
136 ok(0, "unexpected call\n");
140 static HRESULT WINAPI
OleContainer_LockContainer(IOleContainer
*iface
, BOOL fLock
)
142 ok(0, "unexpected call\n");
146 static const IOleContainerVtbl OleContainerVtbl
= {
147 OleContainer_QueryInterface
,
149 OleContainer_Release
,
150 OleContainer_ParseDisplayName
,
151 OleContainer_EnumObjects
,
152 OleContainer_LockContainer
155 static IOleContainer OleContainer
= { &OleContainerVtbl
};
157 static HRESULT WINAPI
InPlaceFrame_QueryInterface(IOleInPlaceFrame
*iface
, REFIID riid
, void **ppv
)
159 ok(0, "Unexpected QI(%s)\n", wine_dbgstr_guid(riid
));
161 return E_NOINTERFACE
;
164 static ULONG WINAPI
InPlaceFrame_AddRef(IOleInPlaceFrame
*iface
)
169 static ULONG WINAPI
InPlaceFrame_Release(IOleInPlaceFrame
*iface
)
174 static HRESULT WINAPI
InPlaceFrame_GetWindow(IOleInPlaceFrame
*iface
, HWND
*phwnd
)
176 ok(0, "unexpected call\n");
180 static HRESULT WINAPI
InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame
*iface
, BOOL fEnterMode
)
182 ok(0, "unexpected call\n");
186 static HRESULT WINAPI
InPlaceFrame_GetBorder(IOleInPlaceFrame
*iface
, LPRECT lprectBorder
)
188 ok(0, "unexpected call\n");
192 static HRESULT WINAPI
InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame
*iface
,
193 LPCBORDERWIDTHS pborderwidths
)
195 ok(0, "unexpected call\n");
199 static HRESULT WINAPI
InPlaceFrame_SetBorderSpace(IOleInPlaceFrame
*iface
,
200 LPCBORDERWIDTHS pborderwidths
)
202 ok(0, "unexpected call\n");
206 static HRESULT WINAPI
InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame
*iface
,
207 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
209 ok(0, "unexpected call\n");
213 static HRESULT WINAPI
InPlaceFrame_SetActiveObject(IOleInPlaceFrame
*iface
,
214 IOleInPlaceActiveObject
*pActiveObject
, LPCOLESTR pszObjName
)
216 ok(0, "unexpected call\n");
220 static HRESULT WINAPI
InPlaceFrame_InsertMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
221 LPOLEMENUGROUPWIDTHS lpMenuWidths
)
223 ok(0, "unexpected call\n");
227 static HRESULT WINAPI
InPlaceFrame_SetMenu(IOleInPlaceFrame
*iface
, HMENU hmenuShared
,
228 HOLEMENU holemenu
, HWND hwndActiveObject
)
230 ok(0, "unexpected call\n");
234 static HRESULT WINAPI
InPlaceFrame_RemoveMenus(IOleInPlaceFrame
*iface
, HMENU hmenuShared
)
236 ok(0, "unexpected call\n");
240 static HRESULT WINAPI
InPlaceFrame_SetStatusText(IOleInPlaceFrame
*iface
, LPCOLESTR pszStatusText
)
242 ok(0, "unexpected call\n");
246 static HRESULT WINAPI
InPlaceFrame_EnableModeless(IOleInPlaceFrame
*iface
, BOOL fEnable
)
248 ok(0, "unexpected call\n");
252 static HRESULT WINAPI
InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame
*iface
, LPMSG lpmsg
, WORD wID
)
254 ok(0, "unexpected call\n");
258 static const IOleInPlaceFrameVtbl InPlaceFrameVtbl
= {
259 InPlaceFrame_QueryInterface
,
261 InPlaceFrame_Release
,
262 InPlaceFrame_GetWindow
,
263 InPlaceFrame_ContextSensitiveHelp
,
264 InPlaceFrame_GetBorder
,
265 InPlaceFrame_RequestBorderSpace
,
266 InPlaceFrame_SetBorderSpace
,
267 InPlaceFrame_SetActiveObject
,
268 InPlaceFrame_InsertMenus
,
269 InPlaceFrame_SetMenu
,
270 InPlaceFrame_RemoveMenus
,
271 InPlaceFrame_SetStatusText
,
272 InPlaceFrame_EnableModeless
,
273 InPlaceFrame_TranslateAccelerator
276 static IOleInPlaceFrame InPlaceFrame
= { &InPlaceFrameVtbl
};
278 static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl
= {
279 InPlaceFrame_QueryInterface
,
281 InPlaceFrame_Release
,
282 InPlaceFrame_GetWindow
,
283 InPlaceFrame_ContextSensitiveHelp
,
284 InPlaceFrame_GetBorder
,
285 InPlaceFrame_RequestBorderSpace
,
286 InPlaceFrame_SetBorderSpace
,
287 InPlaceUIWindow_SetActiveObject
,
290 static IOleInPlaceFrame InPlaceUIWindow
= { &InPlaceUIWindowVtbl
};
292 static HRESULT
cs_qi(REFIID
,void**);
294 static HRESULT WINAPI
ClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
296 return cs_qi(riid
, ppv
);
299 static ULONG WINAPI
ClientSite_AddRef(IOleClientSite
*iface
)
304 static ULONG WINAPI
ClientSite_Release(IOleClientSite
*iface
)
309 static HRESULT WINAPI
ClientSite_SaveObject(IOleClientSite
*iface
)
311 ok(0, "unexpected call\n");
315 static HRESULT WINAPI
ClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
, DWORD dwWhichMoniker
,
318 ok(0, "unexpected call\n");
322 static HRESULT WINAPI
ClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**ppContainer
)
324 CHECK_EXPECT2(GetContainer
);
326 *ppContainer
= &OleContainer
;
330 static HRESULT WINAPI
ClientSite_ShowObject(IOleClientSite
*iface
)
332 CHECK_EXPECT(ShowObject
);
336 static HRESULT WINAPI
ClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
339 ok(0, "unexpected call\n");
341 CHECK_EXPECT(OnShowWindow_FALSE
);
345 static HRESULT WINAPI
ClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
347 ok(0, "unexpected call\n");
351 static const IOleClientSiteVtbl ClientSiteVtbl
= {
352 ClientSite_QueryInterface
,
355 ClientSite_SaveObject
,
356 ClientSite_GetMoniker
,
357 ClientSite_GetContainer
,
358 ClientSite_ShowObject
,
359 ClientSite_OnShowWindow
,
360 ClientSite_RequestNewObjectLayout
363 static IOleClientSite ClientSite
= { &ClientSiteVtbl
};
365 static HRESULT WINAPI
ServiceProvider_QueryInterface(IServiceProvider
*iface
,
366 REFIID riid
, void **ppv
)
368 return cs_qi(riid
, ppv
);
371 static ULONG WINAPI
ServiceProvider_AddRef(IServiceProvider
*iface
)
376 static ULONG WINAPI
ServiceProvider_Release(IServiceProvider
*iface
)
381 static HRESULT WINAPI
ServiceProvider_QueryService(IServiceProvider
*iface
, REFGUID guidService
,
382 REFIID riid
, void **ppv
)
384 trace("QS(%s)\n", wine_dbgstr_guid(guidService
));
386 return E_NOINTERFACE
;
389 static const IServiceProviderVtbl ServiceProviderVtbl
= {
390 ServiceProvider_QueryInterface
,
391 ServiceProvider_AddRef
,
392 ServiceProvider_Release
,
393 ServiceProvider_QueryService
396 static IServiceProvider ServiceProvider
= { &ServiceProviderVtbl
};
398 static HRESULT WINAPI
OleControlSite_QueryInterface(IOleControlSite
*iface
, REFIID riid
, void **ppv
)
400 return cs_qi(riid
, ppv
);
403 static ULONG WINAPI
OleControlSite_AddRef(IOleControlSite
*iface
)
408 static ULONG WINAPI
OleControlSite_Release(IOleControlSite
*iface
)
413 static HRESULT WINAPI
OleControlSite_OnControlInfoChanged(IOleControlSite
*iface
)
415 ok(0, "unexpected call\n");
419 static HRESULT WINAPI
OleControlSite_LockInPlaceActive(IOleControlSite
*iface
, BOOL fLock
)
421 ok(0, "unexpected call\n");
425 static HRESULT WINAPI
OleControlSite_GetExtendedControl(IOleControlSite
*iface
, IDispatch
**ppDisp
)
427 CHECK_EXPECT(GetExtendedControl
);
431 static HRESULT WINAPI
OleControlSite_TransformCoords(IOleControlSite
*iface
, POINTL
*pPtHimetric
,
432 POINTF
*pPtfContainer
, DWORD dwFlags
)
434 ok(0, "unexpected call\n");
438 static HRESULT WINAPI
OleControlSite_TranslateAccelerator(IOleControlSite
*iface
,
439 MSG
*pMsg
, DWORD grfModifiers
)
441 ok(0, "unexpected call\n");
445 static HRESULT WINAPI
OleControlSite_OnFocus(IOleControlSite
*iface
, BOOL fGotFocus
)
447 ok(0, "unexpected call\n");
451 static HRESULT WINAPI
OleControlSite_ShowPropertyFrame(IOleControlSite
*iface
)
453 ok(0, "unexpected call\n");
457 static const IOleControlSiteVtbl OleControlSiteVtbl
= {
458 OleControlSite_QueryInterface
,
459 OleControlSite_AddRef
,
460 OleControlSite_Release
,
461 OleControlSite_OnControlInfoChanged
,
462 OleControlSite_LockInPlaceActive
,
463 OleControlSite_GetExtendedControl
,
464 OleControlSite_TransformCoords
,
465 OleControlSite_TranslateAccelerator
,
466 OleControlSite_OnFocus
,
467 OleControlSite_ShowPropertyFrame
470 static IOleControlSite OleControlSite
= { &OleControlSiteVtbl
};
472 static HRESULT WINAPI
Dispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
474 return cs_qi(riid
, ppv
);
477 static ULONG WINAPI
Dispatch_AddRef(IDispatch
*iface
)
482 static ULONG WINAPI
Dispatch_Release(IDispatch
*iface
)
487 static HRESULT WINAPI
Dispatch_GetTypeInfoCount(IDispatch
*iface
, UINT
*pctinfo
)
489 ok(0, "unexpected call\n");
493 static HRESULT WINAPI
Dispatch_GetTypeInfo(IDispatch
*iface
, UINT iTInfo
, LCID lcid
,
496 ok(0, "unexpected call\n");
500 static HRESULT WINAPI
Dispatch_GetIDsOfNames(IDispatch
*iface
, REFIID riid
, LPOLESTR
*rgszNames
,
501 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
503 ok(0, "unexpected call\n");
507 static HRESULT WINAPI
Dispatch_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
508 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
509 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
511 switch(dispIdMember
) {
512 case DISPID_AMBIENT_USERMODE
:
513 CHECK_EXPECT(Invoke_USERMODE
);
516 ok(0, "unexpected call Invoke(%d)\n", dispIdMember
);
522 static const IDispatchVtbl DispatchVtbl
= {
523 Dispatch_QueryInterface
,
526 Dispatch_GetTypeInfoCount
,
527 Dispatch_GetTypeInfo
,
528 Dispatch_GetIDsOfNames
,
532 static IDispatch Dispatch
= { &DispatchVtbl
};
534 static HRESULT WINAPI
WMPOCXEvents_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
538 if(IsEqualGUID(&IID__WMPOCXEvents
, riid
) || IsEqualGUID(&IID_IDispatch
, riid
)) {
543 ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid
));
544 return E_NOINTERFACE
;
547 static HRESULT WINAPI
WMPOCXEvents_Invoke(IDispatch
*iface
, DISPID dispIdMember
, REFIID riid
,
548 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
549 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
551 switch(dispIdMember
) {
553 ok(0, "unexpected call Invoke(%d)\n", dispIdMember
);
559 static IDispatchVtbl WMPOcxEventsVtbl
= {
560 WMPOCXEvents_QueryInterface
,
563 Dispatch_GetTypeInfoCount
,
564 Dispatch_GetTypeInfo
,
565 Dispatch_GetIDsOfNames
,
569 static IDispatch WMPOCXEvents
= { &WMPOcxEventsVtbl
};
571 static HRESULT WINAPI
InPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless
*iface
, REFIID riid
, void **ppv
)
573 return cs_qi(riid
, ppv
);
576 static ULONG WINAPI
InPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless
*iface
)
581 static ULONG WINAPI
InPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless
*iface
)
586 static HRESULT WINAPI
InPlaceSiteWindowless_GetWindow(IOleInPlaceSiteWindowless
*iface
, HWND
*phwnd
)
588 CHECK_EXPECT2(GetWindow
);
589 *phwnd
= container_hwnd
;
593 static HRESULT WINAPI
InPlaceSiteWindowless_ContextSensitiveHelp(IOleInPlaceSiteWindowless
*iface
, BOOL fEnterMode
)
595 ok(0, "unexpected call\n");
599 static HRESULT WINAPI
InPlaceSiteWindowless_CanInPlaceActivate(IOleInPlaceSiteWindowless
*iface
)
601 ok(0, "unexpected call\n");
605 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceActivate(IOleInPlaceSiteWindowless
*iface
)
607 ok(0, "unexpected call\n");
611 static HRESULT WINAPI
InPlaceSiteWindowless_OnUIActivate(IOleInPlaceSiteWindowless
*iface
)
613 ok(0, "unexpected call\n");
617 static HRESULT WINAPI
InPlaceSiteWindowless_GetWindowContext(IOleInPlaceSiteWindowless
*iface
, IOleInPlaceFrame
**ppFrame
,
618 IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
, LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
620 static const RECT rect
= {0,0,400,410};
622 CHECK_EXPECT(GetWindowContext
);
624 ok(ppFrame
!= NULL
, "ppFrame = NULL\n");
626 *ppFrame
= &InPlaceFrame
;
627 ok(ppDoc
!= NULL
, "ppDoc = NULL\n");
629 *ppDoc
= (IOleInPlaceUIWindow
*)&InPlaceUIWindow
;
630 ok(lprcPosRect
!= NULL
, "lprcPosRect = NULL\n");
632 memcpy(lprcPosRect
, &rect
, sizeof(RECT
));
633 ok(lprcClipRect
!= NULL
, "lprcClipRect = NULL\n");
635 memcpy(lprcClipRect
, &rect
, sizeof(RECT
));
636 ok(lpFrameInfo
!= NULL
, "lpFrameInfo = NULL\n");
638 ok(lpFrameInfo
->cb
== sizeof(*lpFrameInfo
), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo
->cb
, (unsigned)sizeof(*lpFrameInfo
));
639 lpFrameInfo
->fMDIApp
= FALSE
;
640 lpFrameInfo
->hwndFrame
= container_hwnd
;
641 lpFrameInfo
->haccel
= NULL
;
642 lpFrameInfo
->cAccelEntries
= 0;
648 static HRESULT WINAPI
InPlaceSiteWindowless_Scroll(
649 IOleInPlaceSiteWindowless
*iface
, SIZE scrollExtent
)
651 ok(0, "unexpected call\n");
655 static HRESULT WINAPI
InPlaceSiteWindowless_OnUIDeactivate(
656 IOleInPlaceSiteWindowless
*iface
, BOOL fUndoable
)
658 ok(0, "unexpected call\n");
662 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceDeactivate(
663 IOleInPlaceSiteWindowless
*iface
)
665 CHECK_EXPECT(OnInPlaceDeactivate
);
669 static HRESULT WINAPI
InPlaceSiteWindowless_DiscardUndoState(
670 IOleInPlaceSiteWindowless
*iface
)
672 ok(0, "unexpected call\n");
676 static HRESULT WINAPI
InPlaceSiteWindowless_DeactivateAndUndo(
677 IOleInPlaceSiteWindowless
*iface
)
679 ok(0, "unexpected call\n");
683 static HRESULT WINAPI
InPlaceSiteWindowless_OnPosRectChange(
684 IOleInPlaceSiteWindowless
*iface
, LPCRECT lprcPosRect
)
686 ok(0, "unexpected call\n");
690 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceActivateEx(
691 IOleInPlaceSiteWindowless
*iface
, BOOL
*pfNoRedraw
, DWORD dwFlags
)
693 CHECK_EXPECT(OnInPlaceActivateEx
);
694 ok(!dwFlags
, "dwFlags = %x\n", dwFlags
);
695 ok(pfNoRedraw
!= NULL
, "pfNoRedraw = NULL\n");
699 static HRESULT WINAPI
InPlaceSiteWindowless_OnInPlaceDeactivateEx(
700 IOleInPlaceSiteWindowless
*iface
, BOOL fNoRedraw
)
702 ok(0, "unexpected call\n");
706 static HRESULT WINAPI
InPlaceSiteWindowless_RequestUIActivate(
707 IOleInPlaceSiteWindowless
*iface
)
709 ok(0, "unexpected call\n");
713 static HRESULT WINAPI
InPlaceSiteWindowless_CanWindowlessActivate(
714 IOleInPlaceSiteWindowless
*iface
)
716 CHECK_EXPECT(CanWindowlessActivate
);
720 static HRESULT WINAPI
InPlaceSiteWindowless_GetCapture(
721 IOleInPlaceSiteWindowless
*iface
)
723 ok(0, "unexpected call\n");
727 static HRESULT WINAPI
InPlaceSiteWindowless_SetCapture(
728 IOleInPlaceSiteWindowless
*iface
, BOOL fCapture
)
730 ok(0, "unexpected call\n");
734 static HRESULT WINAPI
InPlaceSiteWindowless_GetFocus(
735 IOleInPlaceSiteWindowless
*iface
)
737 ok(0, "unexpected call\n");
741 static HRESULT WINAPI
InPlaceSiteWindowless_SetFocus(
742 IOleInPlaceSiteWindowless
*iface
, BOOL fFocus
)
744 ok(0, "unexpected call\n");
748 static HRESULT WINAPI
InPlaceSiteWindowless_GetDC(
749 IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
,
750 DWORD grfFlags
, HDC
*phDC
)
752 ok(0, "unexpected call\n");
756 static HRESULT WINAPI
InPlaceSiteWindowless_ReleaseDC(
757 IOleInPlaceSiteWindowless
*iface
, HDC hDC
)
759 ok(0, "unexpected call\n");
763 static HRESULT WINAPI
InPlaceSiteWindowless_InvalidateRect(
764 IOleInPlaceSiteWindowless
*iface
, LPCRECT pRect
, BOOL fErase
)
766 ok(0, "unexpected call\n");
770 static HRESULT WINAPI
InPlaceSiteWindowless_InvalidateRgn(
771 IOleInPlaceSiteWindowless
*iface
, HRGN hRGN
, BOOL fErase
)
773 ok(0, "unexpected call\n");
777 static HRESULT WINAPI
InPlaceSiteWindowless_ScrollRect(
778 IOleInPlaceSiteWindowless
*iface
, INT dx
, INT dy
,
779 LPCRECT pRectScroll
, LPCRECT pRectClip
)
781 ok(0, "unexpected call\n");
785 static HRESULT WINAPI
InPlaceSiteWindowless_AdjustRect(
786 IOleInPlaceSiteWindowless
*iface
, LPRECT prc
)
788 ok(0, "unexpected call\n");
792 static HRESULT WINAPI
InPlaceSiteWindowless_OnDefWindowMessage(
793 IOleInPlaceSiteWindowless
*iface
, UINT msg
,
794 WPARAM wParam
, LPARAM lParam
, LRESULT
*plResult
)
796 ok(0, "unexpected call\n");
800 static const IOleInPlaceSiteWindowlessVtbl InPlaceSiteWindowlessVtbl
= {
801 InPlaceSiteWindowless_QueryInterface
,
802 InPlaceSiteWindowless_AddRef
,
803 InPlaceSiteWindowless_Release
,
804 InPlaceSiteWindowless_GetWindow
,
805 InPlaceSiteWindowless_ContextSensitiveHelp
,
806 InPlaceSiteWindowless_CanInPlaceActivate
,
807 InPlaceSiteWindowless_OnInPlaceActivate
,
808 InPlaceSiteWindowless_OnUIActivate
,
809 InPlaceSiteWindowless_GetWindowContext
,
810 InPlaceSiteWindowless_Scroll
,
811 InPlaceSiteWindowless_OnUIDeactivate
,
812 InPlaceSiteWindowless_OnInPlaceDeactivate
,
813 InPlaceSiteWindowless_DiscardUndoState
,
814 InPlaceSiteWindowless_DeactivateAndUndo
,
815 InPlaceSiteWindowless_OnPosRectChange
,
816 InPlaceSiteWindowless_OnInPlaceActivateEx
,
817 InPlaceSiteWindowless_OnInPlaceDeactivateEx
,
818 InPlaceSiteWindowless_RequestUIActivate
,
819 InPlaceSiteWindowless_CanWindowlessActivate
,
820 InPlaceSiteWindowless_GetCapture
,
821 InPlaceSiteWindowless_SetCapture
,
822 InPlaceSiteWindowless_GetFocus
,
823 InPlaceSiteWindowless_SetFocus
,
824 InPlaceSiteWindowless_GetDC
,
825 InPlaceSiteWindowless_ReleaseDC
,
826 InPlaceSiteWindowless_InvalidateRect
,
827 InPlaceSiteWindowless_InvalidateRgn
,
828 InPlaceSiteWindowless_ScrollRect
,
829 InPlaceSiteWindowless_AdjustRect
,
830 InPlaceSiteWindowless_OnDefWindowMessage
833 static IOleInPlaceSiteWindowless InPlaceSiteWindowless
= { &InPlaceSiteWindowlessVtbl
};
835 static HRESULT
cs_qi(REFIID riid
, void **ppv
)
837 if(IsEqualGUID(riid
, &IID_IUnknown
)) {
839 }else if(IsEqualGUID(riid
, &IID_IOleClientSite
)) {
841 }else if(IsEqualGUID(riid
, &IID_IServiceProvider
)) {
842 *ppv
= &ServiceProvider
;
843 }else if(IsEqualGUID(riid
, &IID_IOleControlSite
)) {
844 *ppv
= &OleControlSite
;
845 }else if(IsEqualGUID(riid
, &IID_IDispatch
)) {
847 }else if(IsEqualGUID(&IID_IOleWindow
, riid
)) {
848 *ppv
= &InPlaceSiteWindowless
;
849 }else if(IsEqualGUID(&IID_IOleInPlaceSite
, riid
)) {
850 *ppv
= &InPlaceSiteWindowless
;
851 }else if(IsEqualGUID(&IID_IOleInPlaceSiteEx
, riid
)) {
852 *ppv
= &InPlaceSiteWindowless
;
853 }else if(IsEqualGUID(&IID_IOleInPlaceSiteWindowless
, riid
)) {
854 *ppv
= &InPlaceSiteWindowless
;
856 trace("QI(%s)\n", wine_dbgstr_guid(riid
));
858 return E_NOINTERFACE
;
864 static void test_ConnectionPoint(IOleObject
*unk
)
866 IConnectionPointContainer
*container
;
867 IConnectionPoint
*point
;
870 static DWORD dw
= 100;
872 hres
= IOleObject_QueryInterface(unk
, &IID_IConnectionPointContainer
, (void**)&container
);
873 ok(hres
== S_OK
, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres
);
877 hres
= IConnectionPointContainer_FindConnectionPoint(container
, &IID__WMPOCXEvents
, &point
);
878 IConnectionPointContainer_Release(container
);
879 ok(hres
== S_OK
, "FindConnectionPoint failed: %08x\n", hres
);
883 hres
= IConnectionPoint_Advise(point
, (IUnknown
*)&WMPOCXEvents
, &dw
);
884 ok(hres
== S_OK
, "Advise failed: %08x\n", hres
);
885 ok(dw
== 1, "dw=%d, expected 1\n", dw
);
886 hres
= IConnectionPoint_Unadvise(point
, dw
);
887 ok(hres
== S_OK
, "Unadvise failed: %08x\n", hres
);
889 IConnectionPoint_Release(point
);
892 static void test_wmp_ifaces(IOleObject
*oleobj
)
894 IWMPSettings
*settings
, *settings_qi
;
895 IWMPPlayer4
*player4
;
897 IWMPPlaylist
*playlist
;
899 IWMPControls
*controls
;
901 IWMPNetwork
*network
;
907 hres
= IOleObject_QueryInterface(oleobj
, &IID_IWMPPlayer4
, (void**)&player4
);
908 ok(hres
== S_OK
, "Could not get IWMPPlayer4 iface: %08x\n", hres
);
911 hres
= IWMPPlayer4_get_controls(player4
, &controls
);
912 ok(hres
== S_OK
, "get_controls failed: %08x\n", hres
);
913 ok(controls
!= NULL
, "controls = NULL\n");
916 hres
= IWMPControls_QueryInterface(controls
, &IID_IWMPPlayer
, (void**)&player
);
917 ok(hres
== E_NOINTERFACE
, "Getting IWMPPlayer from IWMPControls SUCCEEDED\n");
918 ok(player
== NULL
, "player != NULL\n");
921 hres
= IWMPControls_QueryInterface(controls
, &IID_IUnknown
, (void **)&unk
);
922 ok(hres
== S_OK
, "Failed to get IUnknown, hr %#x.\n", hres
);
923 ok(unk
!= NULL
, "Unexpected interface pointer.\n");
924 IUnknown_Release(unk
);
926 IWMPControls_Release(controls
);
930 hres
= IWMPPlayer4_get_network(player4
, &network
);
931 ok(hres
== S_OK
, "get_network failed: %08x\n", hres
);
932 ok(network
!= NULL
, "network = NULL\n");
935 hres
= IWMPNetwork_QueryInterface(network
, &IID_IWMPPlayer
, (void**)&player
);
936 ok(hres
!= S_OK
, "Getting IWMPPlayer from IWMPNetwork SUCCEEDED\n");
937 ok(player
== NULL
, "player != NULL\n");
939 IWMPNetwork_Release(network
);
942 hres
= IWMPPlayer4_QueryInterface(player4
, &IID_IWMPPlaylist
, (void**)&playlist
);
943 ok(hres
== E_NOINTERFACE
, "Getting IWMPPlaylist from IWMPPlayer4 succeeded: %08x\n", hres
);
944 ok(playlist
== NULL
, "playlist != NULL\n");
947 hres
= IWMPPlayer4_get_currentPlaylist(player4
, &playlist
);
948 ok(hres
== S_OK
, "IWMPPlayer4_get_currentPlaylist failed: %08x\n", hres
);
949 ok(playlist
!= NULL
, "playlist != NULL\n");
951 IWMPPlaylist_Release(playlist
);
954 hres
= IWMPPlayer4_QueryInterface(player4
, &IID_IWMPMedia
, (void**)&media
);
955 ok(hres
== E_NOINTERFACE
, "get_currentMedia SUCCEEDED: %08x\n", hres
);
956 ok(media
== NULL
, "media != NULL\n");
958 /* Test media put/get */
960 hres
= IWMPPlayer4_get_currentMedia(player4
, &media
);
961 ok(hres
== S_FALSE
, "get_currentMedia SUCCEEDED\n");
962 ok(media
== NULL
, "media != NULL\n");
964 filename
= SysAllocString(load_resource(mp3file
));
966 SET_EXPECT(GetContainer
);
967 SET_EXPECT(Invoke_USERMODE
);
968 hres
= IWMPPlayer4_put_URL(player4
, filename
);
969 ok(hres
== S_OK
, "IWMPPlayer4_put_URL failed: %08x\n", hres
);
970 todo_wine
CHECK_CALLED_OR_BROKEN(GetContainer
);
971 todo_wine
CHECK_CALLED(Invoke_USERMODE
);
974 SET_EXPECT(Invoke_USERMODE
);
975 hres
= IWMPPlayer4_get_URL(player4
, &url
);
976 ok(hres
== S_OK
, "IWMPPlayer4_get_URL failed: %08x\n", hres
);
977 ok(0 == lstrcmpW(url
, filename
), "%s != %s\n", wine_dbgstr_w(url
), wine_dbgstr_w(filename
));
978 todo_wine
CHECK_CALLED(Invoke_USERMODE
);
981 hres
= IWMPPlayer4_get_currentMedia(player4
, &media
);
982 ok(hres
== S_OK
, "get_currentMedia failed: %08x\n", hres
);
983 ok(media
!= NULL
, "media = (%p)\n", media
);
986 hres
= IWMPMedia_get_sourceURL(media
, &url
);
987 ok(hres
== S_OK
, "IWMPMedia_get_sourceURL failed: %08x\n", hres
);
988 ok(0 == lstrcmpW(url
, filename
), "%s != %s\n", wine_dbgstr_w(url
), wine_dbgstr_w(filename
));
991 SET_EXPECT(GetContainer
);
992 hres
= IWMPPlayer4_put_currentMedia(player4
, media
);
993 ok(hres
== S_OK
, "put_currentMedia failed: %08x\n", hres
);
994 todo_wine
CHECK_CALLED_OR_BROKEN(GetContainer
);
996 IWMPMedia_Release(media
);
998 hres
= IWMPPlayer4_get_currentMedia(player4
, &media
);
999 ok(hres
== S_OK
, "get_currentMedia failed: %08x\n", hres
);
1000 ok(media
!= NULL
, "media = (%p)\n", media
);
1002 IWMPMedia_Release(media
);
1005 hres
= IWMPPlayer4_get_settings(player4
, &settings
);
1006 ok(hres
== S_OK
, "get_settings failed: %08x\n", hres
);
1007 ok(settings
!= NULL
, "settings = NULL\n");
1009 hres
= IOleObject_QueryInterface(oleobj
, &IID_IWMPSettings
, (void**)&settings_qi
);
1010 ok(hres
== S_OK
, "Could not get IWMPSettings iface: %08x\n", hres
);
1011 ok(settings
== settings_qi
, "settings != settings_qi\n");
1012 IWMPSettings_Release(settings_qi
);
1014 /* Test few settings put/gets */
1015 hres
= IWMPSettings_get_autoStart(settings
, &vbool
);
1016 ok(hres
== S_OK
, "Could not get autoStart from IWMPSettings: %08x\n", hres
);
1017 ok(vbool
== VARIANT_TRUE
, "autoStart = %x\n", vbool
);
1018 hres
= IWMPSettings_put_autoStart(settings
, VARIANT_FALSE
);
1019 ok(hres
== S_OK
, "Could not put autoStart in IWMPSettings: %08x\n", hres
);
1020 hres
= IWMPSettings_get_autoStart(settings
, &vbool
);
1021 ok(hres
== S_OK
, "Could not get autoStart from IWMPSettings: %08x\n", hres
);
1022 ok(!vbool
, "autoStart = %x\n", vbool
);
1024 hres
= IWMPSettings_get_invokeURLs(settings
, &vbool
);
1025 ok(hres
== S_OK
, "Could not get invokeURLs from IWMPSettings: %08x\n", hres
);
1026 ok(vbool
== VARIANT_TRUE
, "invokeURLs = %x\n", vbool
);
1027 hres
= IWMPSettings_put_invokeURLs(settings
, VARIANT_FALSE
);
1028 ok(hres
== S_OK
, "Could not put invokeURLs in IWMPSettings: %08x\n", hres
);
1029 hres
= IWMPSettings_get_invokeURLs(settings
, &vbool
);
1030 ok(hres
== S_OK
, "Could not get invokeURLs from IWMPSettings: %08x\n", hres
);
1031 ok(!vbool
, "invokeURLs = %x\n", vbool
);
1033 hres
= IWMPSettings_get_enableErrorDialogs(settings
, &vbool
);
1034 ok(hres
== S_OK
, "Could not get enableErrorDialogs from IWMPSettings: %08x\n", hres
);
1035 ok(vbool
== VARIANT_FALSE
, "enableErrorDialogs = %x\n", vbool
);
1036 hres
= IWMPSettings_put_enableErrorDialogs(settings
, VARIANT_TRUE
);
1037 ok(hres
== S_OK
, "Could not put enableErrorDialogs in IWMPSettings: %08x\n", hres
);
1038 hres
= IWMPSettings_get_enableErrorDialogs(settings
, &vbool
);
1039 ok(hres
== S_OK
, "Could not get enableErrorDialogs from IWMPSettings: %08x\n", hres
);
1040 ok(vbool
== VARIANT_TRUE
, "enableErrorDialogs = %x\n", vbool
);
1042 IWMPSettings_Release(settings
);
1043 IWMPPlayer4_Release(player4
);
1045 hres
= IOleObject_QueryInterface(oleobj
, &IID_IWMPPlayer
, (void**)&player
);
1046 ok(hres
== S_OK
, "Could not get IWMPPlayer iface: %08x\n", hres
);
1049 hres
= IWMPPlayer_get_settings(player
, &settings
);
1050 ok(hres
== S_OK
, "get_settings failed: %08x\n", hres
);
1051 ok(settings
!= NULL
, "settings = NULL\n");
1053 hres
= IOleObject_QueryInterface(oleobj
, &IID_IWMPSettings
, (void**)&settings_qi
);
1054 ok(hres
== S_OK
, "Could not get IWMPSettings iface: %08x\n", hres
);
1055 ok(settings
== settings_qi
, "settings != settings_qi\n");
1056 IWMPSettings_Release(settings_qi
);
1058 IWMPSettings_Release(settings
);
1059 IWMPPlayer_Release(player
);
1060 DeleteFileW(filename
);
1061 SysFreeString(filename
);
1064 #define test_rect_size(a,b,c) _test_rect_size(__LINE__,a,b,c)
1065 static void _test_rect_size(unsigned line
, const RECT
*r
, int width
, int height
)
1067 ok_(__FILE__
,line
)(r
->right
-r
->left
== width
, "width = %d, expected %d\n", r
->right
-r
->left
, width
);
1068 ok_(__FILE__
,line
)(r
->bottom
-r
->top
== height
, "height = %d, expected %d\n", r
->bottom
-r
->top
, height
);
1071 static void test_window(HWND hwnd
)
1073 WINDOWINFO wi
= {sizeof(wi
)};
1074 char class_name
[100];
1078 i
= RealGetWindowClassA(hwnd
, class_name
, sizeof(class_name
));
1079 ok(!strncmp(class_name
, "ATL:", 4), "class_name = %s %d\n", class_name
, i
);
1081 res
= GetWindowInfo(hwnd
, &wi
);
1082 ok(res
, "GetWindowInfo failed: %u\n", GetLastError());
1084 test_rect_size(&wi
.rcWindow
, 400, 410);
1085 test_rect_size(&wi
.rcClient
, 400, 410);
1087 ok(wi
.dwStyle
== (WS_CLIPCHILDREN
|WS_CLIPSIBLINGS
|WS_VISIBLE
|WS_CHILD
), "dwStyle = %x\n", wi
.dwStyle
);
1088 ok(!(wi
.dwExStyle
& ~0x800 /* undocumented, set by some versions */), "dwExStyle = %x\n", wi
.dwExStyle
);
1090 ok(IsWindowVisible(hwnd
), "Window is not visible\n");
1093 static void test_QI(IUnknown
*unk
)
1098 hres
= IUnknown_QueryInterface(unk
, &IID_IQuickActivate
, (void**)&tmp
);
1099 ok(hres
== E_NOINTERFACE
, "Got IQuickActivate iface when no expected\n");
1101 hres
= IUnknown_QueryInterface(unk
, &IID_IMarshal
, (void**)&tmp
);
1102 ok(hres
== E_NOINTERFACE
, "Could not get IMarshal iface: %08x\n", hres
);
1104 hres
= IUnknown_QueryInterface(unk
, &IID_IOleInPlaceObjectWindowless
, (void**)&tmp
);
1105 ok(hres
== S_OK
, "Could not get IOleInPlaceObjectWindowless iface: %08x\n", hres
);
1106 IUnknown_Release(tmp
);
1109 static void test_IConnectionPointContainer(IOleObject
*oleobj
)
1111 IConnectionPointContainer
*container
;
1112 IConnectionPoint
*point
;
1115 hres
= IOleObject_QueryInterface(oleobj
, &IID_IConnectionPointContainer
, (void**)&container
);
1116 ok(hres
== S_OK
, "Could not get IConnectionPointContainer iface: %08x\n", hres
);
1118 hres
= IConnectionPointContainer_FindConnectionPoint(container
, &IID_IPropertyNotifySink
, &point
);
1119 ok(hres
== CONNECT_E_NOCONNECTION
, "got: %08x\n", hres
);
1122 hres
= IConnectionPointContainer_FindConnectionPoint(container
, &IID_IWMPEvents
, &point
);
1123 todo_wine
ok(hres
== S_OK
, "got: %08x\n", hres
);
1125 IConnectionPoint_Release(point
);
1128 hres
= IConnectionPointContainer_FindConnectionPoint(container
, &IID_IWMPEvents2
, &point
);
1129 todo_wine
ok(hres
== S_OK
, "got: %08x\n", hres
);
1131 IConnectionPoint_Release(point
);
1134 hres
= IConnectionPointContainer_FindConnectionPoint(container
, &IID_IWMPEvents3
, &point
);
1136 todo_wine
win_skip("IWMPEvents3 not supported\n");
1138 IConnectionPoint_Release(point
);
1141 hres
= IConnectionPointContainer_FindConnectionPoint(container
, &IID_IWMPEvents4
, &point
);
1143 todo_wine
win_skip("IWMPEvents4 not supported\n");
1145 IConnectionPoint_Release(point
);
1148 hres
= IConnectionPointContainer_FindConnectionPoint(container
, &IID__WMPOCXEvents
, &point
);
1149 ok(hres
== S_OK
, "got: %08x\n", hres
);
1151 IConnectionPoint_Release(point
);
1153 IConnectionPointContainer_Release(container
);
1156 static void test_extent(IOleObject
*oleobj
)
1158 SIZE expected
, extent
;
1164 /* default aspect ratio is 96dpi / 96dpi */
1166 dpi_x
= GetDeviceCaps(hdc
, LOGPIXELSX
);
1167 dpi_y
= GetDeviceCaps(hdc
, LOGPIXELSY
);
1169 if (dpi_x
!= 96 || dpi_y
!= 96)
1170 trace("dpi: %d / %d\n", dpi_y
, dpi_y
);
1172 extent
.cx
= extent
.cy
= 0xdeadbeef;
1173 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &extent
);
1174 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
1175 expected
.cx
= MulDiv(192, 2540, dpi_x
);
1176 expected
.cy
= MulDiv(192, 2540, dpi_y
);
1177 ok(extent
.cx
== expected
.cx
&& extent
.cy
== expected
.cy
, "size = {%d %d} (expected %d %d)\n",
1178 extent
.cx
, extent
.cy
, expected
.cx
, expected
.cy
);
1182 hres
= IOleObject_SetExtent(oleobj
, DVASPECT_CONTENT
, &extent
);
1183 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
1185 extent
.cx
= extent
.cy
= 0xdeadbeef;
1186 hres
= IOleObject_GetExtent(oleobj
, DVASPECT_CONTENT
, &extent
);
1187 ok(hres
== S_OK
, "GetExtent failed: %08x\n", hres
);
1188 ok(extent
.cx
== 800 && extent
.cy
== 700, "size = {%d %d}\n", extent
.cx
, extent
.cy
);
1190 hres
= IOleObject_GetExtent(oleobj
, 0, &extent
);
1191 ok(hres
== E_FAIL
, "GetExtent failed: %08x\n", hres
);
1192 hres
= IOleObject_GetExtent(oleobj
, 7, &extent
);
1193 ok(hres
== E_FAIL
, "GetExtent failed: %08x\n", hres
);
1197 hres
= IOleObject_SetExtent(oleobj
, DVASPECT_CONTENT
, &expected
);
1198 ok(hres
== S_OK
, "SetExtent failed: %08x\n", hres
);
1200 hres
= IOleObject_SetExtent(oleobj
, 0, &expected
);
1201 ok(hres
== DV_E_DVASPECT
, "SetExtent failed: %08x\n", hres
);
1202 hres
= IOleObject_SetExtent(oleobj
, 7, &expected
);
1203 ok(hres
== DV_E_DVASPECT
, "SetExtent failed: %08x\n", hres
);
1206 static void test_wmp(void)
1208 IProvideClassInfo2
*class_info
;
1209 IOleClientSite
*client_site
;
1210 IOleInPlaceObject
*ipobj
;
1211 IPersistStreamInit
*psi
;
1217 RECT pos
= {0,0,100,100};
1224 hres
= CoCreateInstance(&CLSID_WindowsMediaPlayer
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IOleObject
, (void**)&oleobj
);
1225 if(hres
== REGDB_E_CLASSNOTREG
) {
1226 win_skip("CLSID_WindowsMediaPlayer not registered\n");
1229 ok(hres
== S_OK
, "Could not create CLSID_WindowsMediaPlayer instance: %08x\n", hres
);
1231 hres
= IOleObject_QueryInterface(oleobj
, &IID_IWMPCore
, (void**)&wmpcore
);
1232 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
1234 hres
= IWMPCore_get_versionInfo(wmpcore
, NULL
);
1235 ok(hres
== E_POINTER
, "got 0x%08x\n", hres
);
1237 hres
= IWMPCore_get_versionInfo(wmpcore
, &str
);
1238 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
1241 IWMPCore_Release(wmpcore
);
1243 hres
= IOleObject_QueryInterface(oleobj
, &IID_IProvideClassInfo2
, (void**)&class_info
);
1244 ok(hres
== S_OK
, "Could not get IProvideClassInfo2 iface: %08x\n", hres
);
1246 hres
= IProvideClassInfo2_GetGUID(class_info
, GUIDKIND_DEFAULT_SOURCE_DISP_IID
, &guid
);
1247 ok(hres
== S_OK
, "GetGUID failed: %08x\n", hres
);
1248 ok(IsEqualGUID(&guid
, &IID__WMPOCXEvents
), "guid = %s\n", wine_dbgstr_guid(&guid
));
1250 hres
= IProvideClassInfo2_GetClassInfo(class_info
, &ti
);
1251 ok(hres
== S_OK
, "Failed to get class info, hr %#x.\n", hres
);
1252 hres
= ITypeInfo_GetTypeAttr(ti
, &attr
);
1253 ok(hres
== S_OK
, "Failed to get type attributes, hr %#x.\n", hres
);
1254 ok(IsEqualGUID(&CLSID_WindowsMediaPlayer
, &attr
->guid
), "Unexpected typeinfo guid %s\n", wine_dbgstr_guid(&attr
->guid
));
1255 ITypeInfo_ReleaseTypeAttr(ti
, attr
);
1256 ITypeInfo_Release(ti
);
1258 IProvideClassInfo2_Release(class_info
);
1260 test_QI((IUnknown
*)oleobj
);
1261 test_IConnectionPointContainer(oleobj
);
1262 test_extent(oleobj
);
1264 hres
= IOleObject_GetMiscStatus(oleobj
, DVASPECT_CONTENT
, &misc_status
);
1265 ok(hres
== S_OK
, "GetMiscStatus failed: %08x\n", hres
);
1266 ok(misc_status
== (OLEMISC_SETCLIENTSITEFIRST
|OLEMISC_ACTIVATEWHENVISIBLE
|OLEMISC_INSIDEOUT
1267 |OLEMISC_CANTLINKINSIDE
|OLEMISC_RECOMPOSEONRESIZE
), "misc_status = %x\n", misc_status
);
1269 hres
= IOleObject_QueryInterface(oleobj
, &IID_IPersistStreamInit
, (void**)&psi
);
1270 ok(hres
== S_OK
, "Could not get IPersistStreamInit iface: %08x\n", hres
);
1272 hres
= IOleObject_QueryInterface(oleobj
, &IID_IOleInPlaceObject
, (void**)&ipobj
);
1273 ok(hres
== S_OK
, "Could not get IOleInPlaceObject iface: %08x\n", hres
);
1275 hres
= IPersistStreamInit_InitNew(psi
);
1276 ok(hres
== E_FAIL
|| broken(hres
== S_OK
/* Old WMP */), "InitNew failed: %08x\n", hres
);
1278 SET_EXPECT(GetContainer
);
1279 SET_EXPECT(GetExtendedControl
);
1280 SET_EXPECT(GetWindow
);
1281 SET_EXPECT(Invoke_USERMODE
);
1282 hres
= IOleObject_SetClientSite(oleobj
, &ClientSite
);
1283 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
1284 todo_wine
CHECK_CALLED(GetContainer
);
1285 CHECK_CALLED(GetExtendedControl
);
1286 todo_wine
CHECK_CALLED(GetWindow
);
1287 todo_wine
CHECK_CALLED(Invoke_USERMODE
);
1290 hres
= IOleObject_GetClientSite(oleobj
, &client_site
);
1291 ok(hres
== S_OK
, "GetClientSite failed: %08x\n", hres
);
1292 ok(client_site
== &ClientSite
, "client_site != ClientSite\n");
1294 SET_EXPECT(GetWindow
);
1295 hres
= IPersistStreamInit_InitNew(psi
);
1296 ok(hres
== S_OK
, "InitNew failed: %08x\n", hres
);
1297 CHECK_CALLED(GetWindow
);
1299 hwnd
= (HWND
)0xdeadbeef;
1300 hres
= IOleInPlaceObject_GetWindow(ipobj
, &hwnd
);
1301 ok(hres
== E_UNEXPECTED
, "GetWindow failed: %08x\n", hres
);
1302 ok(!hwnd
, "hwnd = %p\n", hwnd
);
1304 SET_EXPECT(GetWindow
);
1305 SET_EXPECT(CanWindowlessActivate
);
1306 SET_EXPECT(OnInPlaceActivateEx
);
1307 SET_EXPECT(GetWindowContext
);
1308 SET_EXPECT(ShowObject
);
1309 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_INPLACEACTIVATE
, NULL
, &ClientSite
, 0, container_hwnd
, &pos
);
1310 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
1311 CHECK_CALLED(GetWindow
);
1312 CHECK_CALLED(CanWindowlessActivate
);
1313 CHECK_CALLED(OnInPlaceActivateEx
);
1314 CHECK_CALLED(GetWindowContext
);
1315 CHECK_CALLED(ShowObject
);
1318 hres
= IOleInPlaceObject_GetWindow(ipobj
, &hwnd
);
1319 ok(hres
== S_OK
, "GetWindow failed: %08x\n", hres
);
1320 ok(hwnd
!= NULL
, "hwnd = NULL\n");
1324 SetRect(&pos
, 1, 2, 301, 312);
1325 hres
= IOleInPlaceObject_SetObjectRects(ipobj
, &pos
, &pos
);
1326 ok(hres
== S_OK
, "SetObjectRects failed: %08x\n", hres
);
1327 GetClientRect(hwnd
, &pos
);
1328 test_rect_size(&pos
, 300, 310);
1330 test_wmp_ifaces(oleobj
);
1332 hres
= IOleObject_DoVerb(oleobj
, OLEIVERB_HIDE
, NULL
, &ClientSite
, 0, container_hwnd
, &pos
);
1333 ok(hres
== S_OK
, "DoVerb failed: %08x\n", hres
);
1334 ok(!IsWindowVisible(hwnd
), "Window is visible\n");
1336 SET_EXPECT(OnShowWindow_FALSE
);
1337 SET_EXPECT(OnInPlaceDeactivate
);
1338 hres
= IOleObject_Close(oleobj
, 0);
1339 ok(hres
== S_OK
, "Close failed: %08x\n", hres
);
1340 todo_wine
CHECK_CALLED(OnShowWindow_FALSE
);
1341 CHECK_CALLED(OnInPlaceDeactivate
);
1343 hwnd
= (HWND
)0xdeadbeef;
1344 hres
= IOleInPlaceObject_GetWindow(ipobj
, &hwnd
);
1345 ok(hres
== E_UNEXPECTED
, "GetWindow failed: %08x\n", hres
);
1346 ok(!hwnd
, "hwnd = %p\n", hwnd
);
1348 hres
= IOleObject_Close(oleobj
, 0);
1349 ok(hres
== S_OK
, "Close failed: %08x\n", hres
);
1351 hres
= IOleObject_SetClientSite(oleobj
, NULL
);
1352 ok(hres
== S_OK
, "SetClientSite failed: %08x\n", hres
);
1354 client_site
= (void*)0xdeadbeef;
1355 hres
= IOleObject_GetClientSite(oleobj
, &client_site
);
1356 ok(hres
== E_FAIL
|| broken(hres
== S_OK
), "GetClientSite failed: %08x\n", hres
);
1357 ok(!client_site
, "client_site = %p\n", client_site
);
1359 test_ConnectionPoint(oleobj
);
1361 IPersistStreamInit_Release(psi
);
1362 IOleInPlaceObject_Release(ipobj
);
1364 ref
= IOleObject_Release(oleobj
);
1365 ok(!ref
, "ref = %d\n", ref
);
1368 static LRESULT WINAPI
wnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
1370 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
1373 static void create_container_window(void)
1375 static const WCHAR wmp_testW
[] =
1376 {'W','M','P','T','e','s','t',0};
1377 static WNDCLASSEXW wndclass
= {
1378 sizeof(WNDCLASSEXW
),
1381 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
1386 RegisterClassExW(&wndclass
);
1387 container_hwnd
= CreateWindowW(wmp_testW
, wmp_testW
,
1388 WS_OVERLAPPEDWINDOW
, CW_USEDEFAULT
, CW_USEDEFAULT
,
1389 515, 530, NULL
, NULL
, NULL
, NULL
);
1390 ShowWindow(container_hwnd
, SW_SHOW
);
1396 create_container_window();
1400 DestroyWindow(container_hwnd
);