-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwshell.h
More file actions
75 lines (67 loc) · 1.3 KB
/
Copy pathwshell.h
File metadata and controls
75 lines (67 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef _INC_WSHELL_
#define _INC_WSHELL_
#include <windows.h>
#include <shellapi.h>
// Encapsulated NOTIFYICONDATA
struct WNotifyIconData : public NOTIFYICONDATA
{
BOOL Add()
{
return Shell_NotifyIcon(NIM_ADD, this);
}
BOOL Delete()
{
return Shell_NotifyIcon(NIM_DELETE, this);
}
BOOL Modify()
{
return Shell_NotifyIcon(NIM_MODIFY, this);
}
void SetIcon(HICON __hIcon)
{
if (__hIcon)
{
hIcon = __hIcon;
uFlags |= NIF_ICON;
}
else
{
hIcon = __hIcon;
uFlags &= ~NIF_ICON;
}
}
void SetMessage(UINT __uCallbackMessage)
{
if (__uCallbackMessage)
{
uCallbackMessage = __uCallbackMessage;
uFlags |= NIF_MESSAGE;
}
else
{
uCallbackMessage = __uCallbackMessage;
uFlags &= ~NIF_MESSAGE;
}
}
void SetTip(const char *__szTip)
{
if (__szTip)
{
strncpyn(szTip, __szTip, sizeof szTip);
szTip[sizeof(szTip)-1] = 0;
uFlags |= NIF_TIP;
}
else
{
szTip[0] = '\x00';
uFlags &= ~NIF_TIP;
}
}
WNotifyIconData(HWND __hWnd, UINT __uID = 0)
{
cbSize = sizeof(NOTIFYICONDATA);
hWnd = __hWnd;
uID = __uID;
}
};
#endif // _INC_WSHELL_