@@ -29,8 +29,8 @@ extern bool g_DisableUserQuestions;
2929// Set true by CProgressDialog when error messages occur.
3030bool g_bProcessError = false ;
3131
32- # define WM_TRAY_ICON_NOTIFY ( WM_APP + 10 )
33- # define ID_SYSTRAY_ICON 100
32+ static const UINT WM_TRAY_ICON_NOTIFY = WM_APP + 10 ;
33+ static const UINT ID_SYSTRAY_ICON = 100 ;
3434
3535static BOOL SetSysTray (HWND dlg,
3636 DWORD message,
@@ -50,7 +50,7 @@ static BOOL SetSysTray(HWND dlg,
5050 data.uCallbackMessage = callbackMessage;
5151 data.hIcon = icon;
5252
53- if (tip != NULL && *tip != 0 )
53+ if (tip != nullptr && *tip != 0 )
5454 {
5555 ::lstrcpynW (data.szTip, tip, sizeof (data.szTip) / sizeof(WCHAR ));
5656 }
@@ -304,9 +304,9 @@ CProgressDialog::CProgressDialog():
304304 MainWindow(NULL )
305305{
306306 for (int i = 0 ; i < kNumTrayIcons ; i++)
307- _iconSysTrayArray[i] = NULL ;
307+ _iconSysTrayArray[i] = nullptr ;
308308 _sysTrayIconArrayId = -1 ;
309- _sysTrayMenu = NULL ;
309+ _sysTrayMenu = nullptr ;
310310
311311 if (_dialogCreatedEvent.Create () != S_OK )
312312 throw 1334987 ;
@@ -894,7 +894,7 @@ void CProgressDialog::UpdateStatInfo(bool showAll)
894894 *p = 0 ;
895895 SetItemText (IDC_PROGRESS_PERCENT , szPercent);
896896
897- if (_background && _iconSysTrayArray[0 ] != NULL )
897+ if (_background && _iconSysTrayArray[0 ] != nullptr )
898898 UpdateSysTrayIcon (false , true );
899899 }
900900 }
@@ -1127,22 +1127,22 @@ bool CProgressDialog::OnMessage(UINT message, WPARAM wParam, LPARAM lParam)
11271127 }
11281128 if (_background)
11291129 {
1130- SetSysTray (_window, NIM_DELETE , ID_SYSTRAY_ICON , 0 , 0 , NULL , NULL );
1131- if (MainWindow != 0 )
1130+ SetSysTray (_window, NIM_DELETE , ID_SYSTRAY_ICON , 0 , 0 , nullptr , nullptr );
1131+ if (MainWindow != nullptr )
11321132 ShowWindow (MainWindow, SW_SHOW );
11331133 }
1134- if (_iconSysTrayArray[0 ] != NULL )
1134+ if (_iconSysTrayArray[0 ] != nullptr )
11351135 {
11361136 for (int i = 0 ; i < kNumTrayIcons ; i++)
11371137 {
11381138 DestroyIcon (_iconSysTrayArray[i]);
1139- _iconSysTrayArray[i] = NULL ;
1139+ _iconSysTrayArray[i] = nullptr ;
11401140 }
11411141 }
1142- if (_sysTrayMenu != NULL )
1142+ if (_sysTrayMenu != nullptr )
11431143 {
11441144 ::DestroyMenu (_sysTrayMenu);
1145- _sysTrayMenu = NULL ;
1145+ _sysTrayMenu = nullptr ;
11461146 }
11471147 return OnExternalCloseMessage ();
11481148 }
@@ -1204,7 +1204,7 @@ void CProgressDialog::SetPauseText()
12041204 SetItemText (IDB_PAUSE , pszText);
12051205 SetTitleText ();
12061206
1207- if (_sysTrayMenu != NULL )
1207+ if (_sysTrayMenu != nullptr )
12081208 ModifyMenuW (_sysTrayMenu, IDB_PAUSE , MF_BYCOMMAND , IDB_PAUSE , pszText);
12091209}
12101210
@@ -1235,19 +1235,19 @@ void CProgressDialog::OnPriorityButton()
12351235 SetPriorityClass (GetCurrentProcess (), _background ? IDLE_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS );
12361236 if (!_background) // foreground
12371237 {
1238- if (_iconSysTrayArray[0 ] != NULL )
1238+ if (_iconSysTrayArray[0 ] != nullptr )
12391239 {
1240- if (MainWindow != 0 )
1240+ if (MainWindow != nullptr )
12411241 ShowWindow (MainWindow, SW_SHOW );
12421242 Show (SW_SHOW );
1243- SetSysTray (_window, NIM_DELETE , ID_SYSTRAY_ICON , 0 , 0 , NULL , NULL );
1243+ SetSysTray (_window, NIM_DELETE , ID_SYSTRAY_ICON , 0 , 0 , nullptr , nullptr );
12441244 }
12451245 }
12461246 else
12471247 {
12481248 if (LoadSysTrayIcons ())
12491249 {
1250- if (MainWindow != 0 )
1250+ if (MainWindow != nullptr )
12511251 ShowWindow (MainWindow, SW_HIDE );
12521252 Show (SW_HIDE );
12531253 UpdateSysTrayIcon (true , true );
@@ -1501,15 +1501,15 @@ void CProgressDialog::CopyToClipboard()
15011501
15021502bool CProgressDialog::LoadSysTrayIcons ()
15031503{
1504- if (_iconSysTrayArray[0 ] != NULL ) return true ;
1504+ if (_iconSysTrayArray[0 ] != nullptr ) return true ;
15051505
15061506 int id = IDI_SYSTRAY_0 ;
15071507 for (int n = 0 ; n < kNumTrayIcons ; n++, id++)
15081508 {
15091509 _iconSysTrayArray[n] = (HICON )LoadImage (g_hInstance, MAKEINTRESOURCE (id), IMAGE_ICON , 16 , 16 , LR_DEFAULTCOLOR );
15101510 }
15111511
1512- return _iconSysTrayArray[0 ] != NULL ;
1512+ return _iconSysTrayArray[0 ] != nullptr ;
15131513}
15141514
15151515void CProgressDialog::UpdateSysTrayIcon (bool addIcon, bool updateTip)
@@ -1530,7 +1530,7 @@ void CProgressDialog::UpdateSysTrayIcon(bool addIcon, bool updateTip)
15301530
15311531 if (!SetSysTray (_window, NIM_MODIFY , ID_SYSTRAY_ICON , flags, 0 , _iconSysTrayArray[newIconId], tip))
15321532 {
1533- SetSysTray (_window, NIM_DELETE , ID_SYSTRAY_ICON , 0 , 0 , NULL , NULL );
1533+ SetSysTray (_window, NIM_DELETE , ID_SYSTRAY_ICON , 0 , 0 , nullptr , nullptr );
15341534 SetSysTray (_window, NIM_ADD , ID_SYSTRAY_ICON , NIF_ICON | NIF_MESSAGE | NIF_TIP , WM_TRAY_ICON_NOTIFY ,
15351535 _iconSysTrayArray[newIconId], tip);
15361536 }
@@ -1541,13 +1541,13 @@ void CProgressDialog::UpdateSysTrayIcon(bool addIcon, bool updateTip)
15411541
15421542bool CProgressDialog::CreateSysTrayMenu ()
15431543{
1544- if (_sysTrayMenu != NULL ) return true ;
1544+ if (_sysTrayMenu != nullptr ) return true ;
15451545
15461546 _sysTrayMenu = CreatePopupMenu ();
15471547 AppendMenuW (_sysTrayMenu, MF_STRING , IDB_PROGRESS_BACKGROUND , _foreground_String);
15481548 AppendMenuW (_sysTrayMenu, MF_STRING , IDB_PAUSE , Sync.Get_Paused () ? _continue_String : _pause_String);
15491549 AppendMenuW (_sysTrayMenu, MF_STRING , IDCANCEL , cancelString);
1550- return _sysTrayMenu != NULL ;
1550+ return _sysTrayMenu != nullptr ;
15511551}
15521552
15531553bool CProgressDialog::OnTrayNotification (LPARAM lParam)
@@ -1559,7 +1559,7 @@ bool CProgressDialog::OnTrayNotification(LPARAM lParam)
15591559 {
15601560 POINT point;
15611561 ::GetCursorPos (&point);
1562- ::TrackPopupMenu (_sysTrayMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON , point.x, point.y, 0 , _window, NULL );
1562+ ::TrackPopupMenu (_sysTrayMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON , point.x, point.y, 0 , _window, nullptr );
15631563 // BUGFIX: see "PRB: Menus for Notification Icons Don't Work Correctly"
15641564 ::PostMessage (_window, WM_NULL , 0 , 0 );
15651565 }
0 commit comments