1 /* Unit tests for systray
3 * Copyright 2007 Mikolaj Zalewski
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define _WIN32_IE 0x600
25 #include "wine/test.h"
29 static BOOL (WINAPI *pShell_NotifyIconW)(DWORD,PNOTIFYICONDATAW);
31 void test_cbsize(void)
35 if (pShell_NotifyIconW)
39 ZeroMemory(&nidW, sizeof(nidW));
40 nidW.cbSize = NOTIFYICONDATAW_V1_SIZE;
43 nidW.uFlags = NIF_ICON|NIF_MESSAGE;
44 nidW.hIcon = LoadIcon(NULL, IDI_APPLICATION);
45 nidW.uCallbackMessage = WM_USER+17;
46 ok(pShell_NotifyIconW(NIM_ADD, &nidW), "NIM_ADD failed!\n");
48 /* using an invalid cbSize does work */
52 ok(pShell_NotifyIconW(NIM_DELETE, &nidW), "NIM_DELETE failed!\n");
53 /* as icon doesn't exist anymore - now there will be an error */
54 nidW.cbSize = sizeof(nidW);
55 /* wine currently doesn't return error code put prints an ERR(...) */
56 todo_wine ok(!pShell_NotifyIconW(NIM_DELETE, &nidW), "The icon was not deleted\n");
59 /* same for Shell_NotifyIconA */
60 ZeroMemory(&nidA, sizeof(nidA));
61 nidA.cbSize = NOTIFYICONDATAA_V1_SIZE;
64 nidA.uFlags = NIF_ICON|NIF_MESSAGE;
65 nidA.hIcon = LoadIcon(NULL, IDI_APPLICATION);
66 nidA.uCallbackMessage = WM_USER+17;
67 ok(Shell_NotifyIconA(NIM_ADD, &nidA), "NIM_ADD failed!\n");
69 /* using an invalid cbSize does work */
73 ok(Shell_NotifyIconA(NIM_DELETE, &nidA), "NIM_DELETE failed!\n");
74 /* as icon doesn't exist anymore - now there will be an error */
75 nidA.cbSize = sizeof(nidA);
76 /* wine currently doesn't return error code put prints an ERR(...) */
77 todo_wine ok(!Shell_NotifyIconA(NIM_DELETE, &nidA), "The icon was not deleted\n");
87 hdll = GetModuleHandleA("shell32.dll");
88 pShell_NotifyIconW = (void*)GetProcAddress(hdll, "Shell_NotifyIconW");
90 wc.style = CS_HREDRAW | CS_VREDRAW;
93 wc.hInstance = GetModuleHandleA(NULL);
95 wc.hCursor = LoadCursorA(NULL, IDC_IBEAM);
96 wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
97 wc.lpszMenuName = NULL;
98 wc.lpszClassName = "MyTestWnd";
99 wc.lpfnWndProc = DefWindowProc;
102 hMainWnd = CreateWindowExA(0, "MyTestWnd", "Blah", WS_OVERLAPPEDWINDOW,
103 CW_USEDEFAULT, CW_USEDEFAULT, 680, 260, NULL, NULL, GetModuleHandleA(NULL), 0);
104 GetClientRect(hMainWnd, &rc);
105 ShowWindow(hMainWnd, SW_SHOW);
110 while(GetMessageA(&msg,0,0,0)) {
111 TranslateMessage(&msg);
112 DispatchMessageA(&msg);
114 DestroyWindow(hMainWnd);