ReactOS 0.4.16-dev-329-g9223134
DestroyCursorIcon.c
Go to the documentation of this file.
1
2#include "precomp.h"
3
4START_TEST(DestroyCursorIcon)
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 START_TEST(x)
Definition: atltest.h:75
#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:80
BOOL fIcon
Definition: winuser.h:3126
HBITMAP hbmColor
Definition: winuser.h:3130
HBITMAP hbmMask
Definition: winuser.h:3129
#define ZeroMemory
Definition: winbase.h:1737
#define GetModuleHandle
Definition: winbase.h:3852
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:2633
BOOL WINAPI DestroyCursor(_In_ HCURSOR)
Definition: cursoricon.c:2741
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2097
#define LoadCursor
Definition: winuser.h:5824
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2105