44
55clsSysTray::clsSysTray ()
66{
7- bInTray = false ;
8- NotifyIconData.cbSize = sizeof (NotifyIconData);
9- NotifyIconData.uID = uID = 2 ;
10- NotifyIconData.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
11- NotifyIconData.uCallbackMessage = WM_TRAYNOTIFY;
12- NotifyIconData.hIcon = LoadIcon (GetModuleHandle (NULL ), MAKEINTRESOURCE (IDR_MAINFRAME));
13- NotifyIconData.szTip [0 ] = ' \0 ' ;
14- NotifyIconData.hWnd = NULL ;
7+ bInTray = false ;
8+ NotifyIconData.cbSize = sizeof (NotifyIconData);
9+ NotifyIconData.uID = uID = 2 ;
10+ NotifyIconData.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
11+ NotifyIconData.uCallbackMessage = WM_TRAYNOTIFY;
12+ NotifyIconData.hIcon = LoadIcon (GetModuleHandle (NULL ), MAKEINTRESOURCE (IDR_MAINFRAME));
13+ NotifyIconData.szTip [0 ] = ' \0 ' ;
14+ NotifyIconData.hWnd = NULL ;
1515}
1616
1717
@@ -21,69 +21,69 @@ clsSysTray::~clsSysTray()
2121
2222BOOL clsSysTray::SetIcon (HICON hNewIcon)
2323{
24- NotifyIconData.hIcon = hNewIcon;
25- if (bInTray)
26- {
27- BOOL iRetVal;
28- iRetVal = Shell_NotifyIcon (NIM_MODIFY, &NotifyIconData);
29- if (iRetVal)
30- {
31- bInTray = true ;
32- }
33- return iRetVal;
34- }
35- else
36- return (1 );
24+ NotifyIconData.hIcon = hNewIcon;
25+ if (bInTray)
26+ {
27+ BOOL iRetVal;
28+ iRetVal = Shell_NotifyIcon (NIM_MODIFY, &NotifyIconData);
29+ if (iRetVal)
30+ {
31+ bInTray = true ;
32+ }
33+ return iRetVal;
34+ }
35+ else
36+ return (1 );
3737}
3838
3939HICON clsSysTray::GetIcon ()
4040{
41- return NotifyIconData.hIcon ;
41+ return NotifyIconData.hIcon ;
4242}
4343
4444BOOL clsSysTray::SetTipText (char *lpstrNewTipText)
4545{
46- // strncpy(NotifyIconData.szTip, lpstrNewTipText);
47- if (bInTray)
48- {
49- BOOL iRetVal;
50- iRetVal = Shell_NotifyIcon (NIM_MODIFY, &NotifyIconData);
51- if (iRetVal)
52- {
53- bInTray = true ;
54- }
55- return iRetVal;
56- }
57- else
58- return (1 );
46+ // strncpy(NotifyIconData.szTip, lpstrNewTipText);
47+ if (bInTray)
48+ {
49+ BOOL iRetVal;
50+ iRetVal = Shell_NotifyIcon (NIM_MODIFY, &NotifyIconData);
51+ if (iRetVal)
52+ {
53+ bInTray = true ;
54+ }
55+ return iRetVal;
56+ }
57+ else
58+ return (1 );
5959}
6060
6161char *clsSysTray::GetTipText ()
6262{
63- return " test" ; // NotifyIconData.szTip;
63+ return " test" ; // NotifyIconData.szTip;
6464}
6565
6666BOOL clsSysTray::AddIcon ()
6767{
68- BOOL iRetVal;
69- NotifyIconData.hWnd = hWnd;
70- NotifyIconData.uID = uID;
71- iRetVal = Shell_NotifyIcon (NIM_ADD, &NotifyIconData);
72- if (iRetVal)
73- {
74- bInTray = true ;
68+ BOOL iRetVal;
69+ NotifyIconData.hWnd = hWnd;
70+ NotifyIconData.uID = uID;
71+ iRetVal = Shell_NotifyIcon (NIM_ADD, &NotifyIconData);
72+ if (iRetVal)
73+ {
74+ bInTray = true ;
7575
76- }
77- return iRetVal;
76+ }
77+ return iRetVal;
7878}
7979
8080BOOL clsSysTray::RemoveIcon ()
8181{
82- BOOL iRetVal;
83- iRetVal = Shell_NotifyIcon (NIM_DELETE, &NotifyIconData);
84- if (iRetVal)
85- {
86- bInTray = false ;
87- }
88- return iRetVal;
82+ BOOL iRetVal;
83+ iRetVal = Shell_NotifyIcon (NIM_DELETE, &NotifyIconData);
84+ if (iRetVal)
85+ {
86+ bInTray = false ;
87+ }
88+ return iRetVal;
8989}
0 commit comments