ReactOS 0.4.16-dev-329-g9223134
ShellDimScreen.cpp File Reference
#include <apitest.h>
#include <atlbase.h>
#include <atlcom.h>
#include <guiddef.h>
Include dependency graph for ShellDimScreen.cpp:

Go to the source code of this file.

Macros

#define INITGUID
 
#define INVALID_POINTER   ((PVOID)(ULONG_PTR)0xdeadbeefdeadbeefULL)
 

Typedefs

typedef HRESULT(__stdcalltShellDimScreen) (IUnknown **Unknown, HWND *hWindow)
 

Functions

 DEFINE_GUID (CLSID_FadeTask, 0x7EB5FBE4, 0x2100, 0x49E6, 0x85, 0x93, 0x17, 0xE1, 0x30, 0x12, 0x2F, 0x91)
 
static void Test_Dim ()
 
 START_TEST (ShellDimScreen)
 

Variables

tShellDimScreen ShellDimScreen
 

Macro Definition Documentation

◆ INITGUID

#define INITGUID

Definition at line 12 of file ShellDimScreen.cpp.

◆ INVALID_POINTER

#define INVALID_POINTER   ((PVOID)(ULONG_PTR)0xdeadbeefdeadbeefULL)

Definition at line 17 of file ShellDimScreen.cpp.

Typedef Documentation

◆ tShellDimScreen

typedef HRESULT(__stdcall * tShellDimScreen) (IUnknown **Unknown, HWND *hWindow)

Definition at line 19 of file ShellDimScreen.cpp.

Function Documentation

◆ DEFINE_GUID()

DEFINE_GUID ( CLSID_FadeTask  ,
0x7EB5FBE4  ,
0x2100  ,
0x49E6  ,
0x85  ,
0x93  ,
0x17  ,
0xE1  ,
0x30  ,
0x12  ,
0x2F  ,
0x91   
)

◆ START_TEST()

START_TEST ( ShellDimScreen  )

Definition at line 105 of file ShellDimScreen.cpp.

106{
107 HMODULE dll = LoadLibraryA("msgina.dll");
109 if (!dll || !ShellDimScreen)
110 {
111 skip("msgina!#16 not found, skipping tests\n");
112 return;
113 }
114 Test_Dim();
115}
tShellDimScreen ShellDimScreen
static void Test_Dim()
HRESULT(__stdcall * tShellDimScreen)(IUnknown **Unknown, HWND *hWindow)
#define skip(...)
Definition: atltest.h:64
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static HMODULE dll
Definition: str.c:188
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581

◆ Test_Dim()

static void Test_Dim ( )
static

Definition at line 23 of file ShellDimScreen.cpp.

24{
28
31
32 hr = ShellDimScreen(&unk, &wnd);
33 ok_hex(hr, S_OK);
34 ok(unk != INVALID_POINTER, "Expected a valid object\n");
35 ok(wnd != INVALID_POINTER, "Expected a valid window ptr\n");
36 ok(IsWindow(wnd), "Expected a valid window\n");
37 ok(IsWindowVisible(wnd), "Expected the window to be visible\n");
38
39 if (unk != ((IUnknown*)INVALID_POINTER) && unk)
40 {
41 count = unk->Release();
42 ok(count == 0, "Expected count to be 0, was: %lu\n", count);
43 ok(!IsWindow(wnd), "Expected the window to be destroyed\n");
44 }
45
47 wnd = (HWND)INVALID_POINTER;
48 hr = ShellDimScreen(&unk, &wnd);
49 ok_hex(hr, S_OK);
50 ok(unk != ((IUnknown*)INVALID_POINTER), "Expected a valid object\n");
51 ok(wnd != ((HWND)INVALID_POINTER), "Expected a valid window ptr\n");
52 ok(IsWindow(wnd), "Expected a valid window\n");
53 ok(IsWindowVisible(wnd), "Expected the window to be visible\n");
54 char classname[100] = {0};
55 int nRet = GetClassNameA(wnd, classname, 100);
56 ok(nRet == 17, "Expected GetClassName to return 3 was %i\n", nRet);
57 ok(!strcmp(classname, "DimmedWindowClass"), "Expected classname to be DimmedWindowClass, was %s\n", classname);
60 ok(style == expectedstyle, "Expected style to be %lx, was %lx\n", expectedstyle, style);
62 ok(style == WS_EX_TOPMOST, "Expected exstyle to be %x, was %lx\n", WS_EX_TOPMOST, style);
63
64 if (unk != ((IUnknown*)INVALID_POINTER) && unk)
65 {
66 count = unk->AddRef();
67 ok(count == 2, "Expected count to be 2, was: %lu\n", count);
68 count = unk->Release();
69 ok(count == 1, "Expected count to be 1, was: %lu\n", count);
70
71 IUnknown* unk2;
72 hr = unk->QueryInterface(IID_IUnknown, (void**)&unk2);
73 ok_hex(hr, S_OK);
74 if (SUCCEEDED(hr))
75 {
76 ok(unk2 == unk, "Expected the object to be the same, was: %p, %p\n", unk, unk2);
77 unk2->Release();
78 }
79 hr = unk->QueryInterface(CLSID_FadeTask, (void**)&unk2);
81 if (SUCCEEDED(hr))
82 {
83 ok(unk2 == unk, "Expected the object to be the same, was: %p, %p\n", unk, unk2);
84 unk2->Release();
85 }
86 }
87
88 RECT rc;
89 GetWindowRect(wnd, &rc);
90
91 ok(rc.left == GetSystemMetrics(SM_XVIRTUALSCREEN), "Expected rc.left to be %u, was %lu\n", GetSystemMetrics(SM_XVIRTUALSCREEN), rc.left);
92 ok(rc.top == GetSystemMetrics(SM_YVIRTUALSCREEN), "Expected rc.top to be %u, was %lu\n", GetSystemMetrics(SM_YVIRTUALSCREEN), rc.top);
93 ok((rc.right - rc.left) == GetSystemMetrics(SM_CXVIRTUALSCREEN), "Expected rc.left to be %u, was %lu\n", GetSystemMetrics(SM_CXVIRTUALSCREEN), (rc.right - rc.left));
94 ok((rc.bottom - rc.top) == GetSystemMetrics(SM_CYVIRTUALSCREEN), "Expected rc.top to be %u, was %lu\n", GetSystemMetrics(SM_CYVIRTUALSCREEN), (rc.bottom - rc.top));
95
96 if (unk != ((IUnknown*)INVALID_POINTER) && unk)
97 {
98 count = unk->Release();
99 ok(count == 0, "Expected count to be 0, was: %lu\n", count);
100 ok(!IsWindow(wnd), "Expected the window to be destroyed\n");
101 }
102}
#define INVALID_POINTER
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
Arabic default style
Definition: afstyles.h:94
#define ok_hex(expression, result)
Definition: atltest.h:94
#define ok(value,...)
Definition: atltest.h:57
const GUID IID_IUnknown
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
HANDLE HWND
Definition: compat.h:19
GLuint GLuint GLsizei count
Definition: gl.h:1545
ULONG AddRef()
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
ULONG Release()
nsrefcnt Release()
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_EX_TOPMOST
Definition: pedump.c:647
long LONG
Definition: pedump.c:60
#define WS_DISABLED
Definition: pedump.c:621
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
WCHAR classname[128]
Definition: startup.c:15
HRESULT hr
Definition: shlfolder.c:183
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
uint32_t ULONG
Definition: typedefs.h:59
#define E_NOINTERFACE
Definition: winerror.h:2364
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define SM_CYVIRTUALSCREEN
Definition: winuser.h:1042
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int WINAPI GetClassNameA(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPSTR lpClassName, _In_ int nMaxCount)
#define SM_CXVIRTUALSCREEN
Definition: winuser.h:1041
#define GetWindowLong
Definition: winuser.h:5808
#define SM_XVIRTUALSCREEN
Definition: winuser.h:1039
#define GWL_STYLE
Definition: winuser.h:855
BOOL WINAPI IsWindowVisible(_In_ HWND)
int WINAPI GetSystemMetrics(_In_ int)
#define SM_YVIRTUALSCREEN
Definition: winuser.h:1040
#define GWL_EXSTYLE
Definition: winuser.h:854

Referenced by START_TEST().

Variable Documentation

◆ ShellDimScreen

tShellDimScreen ShellDimScreen

Definition at line 21 of file ShellDimScreen.cpp.

Referenced by CallShellDimScreen(), START_TEST(), and Test_Dim().