ReactOS  0.4.14-dev-583-g2a1ba2c
systray.c File Reference
#include <stdarg.h>
#include <windows.h>
#include "shellapi.h"
#include "wine/test.h"
Include dependency graph for systray.c:

Go to the source code of this file.

Macros

#define _WIN32_IE   0x600
 

Functions

static BOOL (WINAPI *pShell_NotifyIconW)(DWORD
 
static void test_cbsize (void)
 
 START_TEST (systray)
 

Variables

static HWND hMainWnd
 
static PNOTIFYICONDATAW
 

Macro Definition Documentation

◆ _WIN32_IE

#define _WIN32_IE   0x600

Definition at line 21 of file systray.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pShell_NotifyIconW)
static

◆ START_TEST()

START_TEST ( systray  )

Definition at line 84 of file systray.c.

85 {
86  WNDCLASSA wc;
87  MSG msg;
88  RECT rc;
89  HMODULE hshell32;
90 
91  hshell32 = GetModuleHandleA("shell32.dll");
92  pShell_NotifyIconW = (void*)GetProcAddress(hshell32, "Shell_NotifyIconW");
93 
95  wc.cbClsExtra = 0;
96  wc.cbWndExtra = 0;
98  wc.hIcon = NULL;
101  wc.lpszMenuName = NULL;
102  wc.lpszClassName = "MyTestWnd";
104  RegisterClassA(&wc);
105 
106  hMainWnd = CreateWindowExA(0, "MyTestWnd", "Blah", WS_OVERLAPPEDWINDOW,
108  GetClientRect(hMainWnd, &rc);
110 
111  test_cbsize();
112 
113  PostQuitMessage(0);
114  while(GetMessageA(&msg,0,0,0)) {
117  }
119 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
int cbClsExtra
Definition: winuser.h:3140
#define CS_HREDRAW
Definition: winuser.h:648
LPCSTR lpszMenuName
Definition: winuser.h:3146
HBRUSH hbrBackground
Definition: winuser.h:3145
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
char * LPSTR
Definition: xmlstorage.h:182
BOOL WINAPI DestroyWindow(_In_ HWND)
#define COLOR_WINDOW
Definition: winuser.h:908
#define IDC_IBEAM
Definition: winuser.h:683
int cbWndExtra
Definition: winuser.h:3141
HCURSOR hCursor
Definition: winuser.h:3144
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
#define CS_VREDRAW
Definition: winuser.h:653
static HWND hMainWnd
Definition: systray.c:31
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPCSTR lpszClassName
Definition: winuser.h:3147
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
UINT style
Definition: winuser.h:3138
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HINSTANCE hInstance
Definition: winuser.h:3142
static void test_cbsize(void)
Definition: systray.c:34
WNDPROC lpfnWndProc
Definition: winuser.h:3139
#define msg(x)
Definition: auth_time.c:54
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define GetProcAddress(x, y)
Definition: compat.h:418
HBRUSH WINAPI GetSysColorBrush(_In_ int)
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
HICON hIcon
Definition: winuser.h:3143

◆ test_cbsize()

static void test_cbsize ( void  )
static

Definition at line 34 of file systray.c.

35 {
36  NOTIFYICONDATAA nidA;
37  BOOL ret;
38 
39  if (pShell_NotifyIconW)
40  {
41  NOTIFYICONDATAW nidW;
42 
43  ZeroMemory(&nidW, sizeof(nidW));
45  nidW.hWnd = hMainWnd;
46  nidW.uID = 1;
49  nidW.uCallbackMessage = WM_USER+17;
50  ret = pShell_NotifyIconW(NIM_ADD, &nidW);
51  ok(ret, "NIM_ADD failed!\n");
52  /* using an invalid cbSize does work */
53  nidW.cbSize = 3;
54  nidW.hWnd = hMainWnd;
55  nidW.uID = 1;
56  ret = pShell_NotifyIconW(NIM_DELETE, &nidW);
57  ok( ret || broken(!ret), /* nt4 */ "NIM_DELETE failed!\n");
58  /* as icon doesn't exist anymore - now there will be an error */
59  nidW.cbSize = sizeof(nidW);
60  ok(!pShell_NotifyIconW(NIM_DELETE, &nidW) != !ret, "The icon was not deleted\n");
61  }
62 
63  /* same for Shell_NotifyIconA */
64  ZeroMemory(&nidA, sizeof(nidA));
66  nidA.hWnd = hMainWnd;
67  nidA.uID = 1;
70  nidA.uCallbackMessage = WM_USER+17;
71  ok(Shell_NotifyIconA(NIM_ADD, &nidA), "NIM_ADD failed!\n");
72 
73  /* using an invalid cbSize does work */
74  nidA.cbSize = 3;
75  nidA.hWnd = hMainWnd;
76  nidA.uID = 1;
78  ok(ret, "NIM_DELETE failed!\n");
79  /* as icon doesn't exist anymore - now there will be an error */
80  nidA.cbSize = sizeof(nidA);
81  ok(!Shell_NotifyIconA(NIM_DELETE, &nidA) != !ret, "The icon was not deleted\n");
82 }
#define NIF_MESSAGE
Definition: shellapi.h:102
#define NOTIFYICONDATAA_V1_SIZE
Definition: shellapi.h:284
#define ZeroMemory
Definition: winbase.h:1642
#define IDI_APPLICATION
Definition: winuser.h:699
char * LPSTR
Definition: xmlstorage.h:182
HICON WINAPI LoadIconA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2029
UINT uCallbackMessage
Definition: shellapi.h:259
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define NIF_ICON
Definition: shellapi.h:103
#define NIM_DELETE
Definition: shellapi.h:93
int ret
static HWND hMainWnd
Definition: systray.c:31
#define NOTIFYICONDATAW_V1_SIZE
Definition: shellapi.h:285
#define WM_USER
Definition: winuser.h:1877
#define broken(x)
Definition: _sntprintf.h:21
UINT uCallbackMessage
Definition: shellapi.h:229
#define ok(value,...)
Definition: atltest.h:57
BOOL WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATAA pnid)
Definition: systray.cpp:31
#define NIM_ADD
Definition: shellapi.h:91

Referenced by START_TEST().

Variable Documentation

◆ hMainWnd

HWND hMainWnd
static

Definition at line 31 of file systray.c.

Referenced by START_TEST(), and test_cbsize().

◆ PNOTIFYICONDATAW

Definition at line 32 of file systray.c.