ReactOS 0.4.15-dev-7968-g24a56f8
DestroyCursorIcon.c File Reference
#include "precomp.h"
Include dependency graph for DestroyCursorIcon.c:

Go to the source code of this file.

Functions

 START_TEST (DestroyCursorIcon)
 

Function Documentation

◆ START_TEST()

START_TEST ( DestroyCursorIcon  )

Definition at line 4 of file DestroyCursorIcon.c.

5{
6 HICON hicon;
7 HCURSOR hcursor;
8 ICONINFO iconinfo;
9
10 ZeroMemory(&iconinfo, sizeof(iconinfo));
11
12 iconinfo.hbmMask = CreateBitmap(8, 16, 1, 1, NULL);
13 ok(iconinfo.hbmMask != NULL, "\n");
14
15 /*
16 * Test if DestroyCursor can destroy an icon, and vice-versa .
17 * It can.
18 */
19 iconinfo.fIcon = TRUE;
20 hicon = CreateIconIndirect(&iconinfo);
21 ok(hicon != 0, "should not fail\n");
22 ok(DestroyCursor(hicon), "\n");
23 ok(!DestroyIcon(hicon), "\n");
24
25 iconinfo.fIcon = FALSE;
26 hcursor = CreateIconIndirect(&iconinfo);
27 ok(hcursor != 0, "should not fail\n");
28 ok(DestroyIcon(hcursor), "\n");
29 ok(!DestroyCursor(hcursor), "\n");
30
31 /* Clean up */
32 DeleteObject(iconinfo.hbmMask);
33
34 /* Now check its behaviour regarding Shared icons/cursors */
35 hcursor = LoadCursor(GetModuleHandle(NULL), "TESTCURSOR");
36 ok(hcursor != 0, "\n");
37
38 /* MSDN says we shouldn't do that, but it still succeeds */
39 ok(DestroyCursor(hcursor), "\n");
40
41 /* In fact, it's still there */
42 ZeroMemory(&iconinfo, sizeof(iconinfo));
43 ok(GetIconInfo(hcursor, &iconinfo), "\n");
44 ok(iconinfo.hbmMask != NULL, "\n");
45 ok(iconinfo.hbmColor != NULL, "\n");
46 ok(!iconinfo.fIcon, "\n");
47
48 /* clean up */
49 DeleteObject(iconinfo.hbmMask);
50 DeleteObject(iconinfo.hbmColor);
51}
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
pKey DeleteObject()
static HICON
Definition: imagelist.c:84
BOOL fIcon
Definition: winuser.h:3123
HBITMAP hbmColor
Definition: winuser.h:3127
HBITMAP hbmMask
Definition: winuser.h:3126
#define ZeroMemory
Definition: winbase.h:1712
#define GetModuleHandle
Definition: winbase.h:3827
HICON HCURSOR
Definition: windef.h:299
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2612
BOOL WINAPI DestroyCursor(_In_ HCURSOR)
Definition: cursoricon.c:2720
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2076
#define LoadCursor
Definition: winuser.h:5812
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2084