55#include " WinSettings.h"
66
77static const char * WINDOW_CLASS = " SplitLoafTray" ;
8- static HINSTANCE g_hInstance = NULL ; // A handle to the current instance of the application.
8+ static HINSTANCE g_hInstance = NULL ;
99
1010LRESULT CALLBACK WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
1111 switch (msg) {
12-
1312 case TRAY_CALLBACK:
1413 if (lParam == WM_RBUTTONUP) {
15- ShowTrayMenu (hwnd); // Show a menu when right clicked.
14+ ShowTrayMenu (hwnd);
1615 }
1716 break ;
1817
1918 case WM_COMMAND:
2019 switch (LOWORD (wParam)) {
2120 case CMD_SETTINGS:
22- OpenSettingsWindow (g_hInstance, hwnd); // Open settings window when that option is selected.
21+ OpenSettingsWindow (g_hInstance, hwnd);
2322 break ;
2423
2524 case CMD_EXIT:
26- PostQuitMessage (0 ); // Exit the program if the option is selected.
25+ PostQuitMessage (0 );
2726 break ;
2827 }
2928 break ;
3029
3130 case WM_DESTROY:
32- RemoveTrayIcon (); // Close the app and remove it from the System Tray.
31+ RemoveTrayIcon ();
3332 PostQuitMessage (0 );
3433 return 0 ;
3534 }
3635
3736 return DefWindowProc (hwnd, msg, wParam, lParam);
3837}
3938
40- int RunWindowsApp ( ) {
39+ int RunWindowsApp ( ) {
4140 HANDLE hMutex = CreateMutexA (NULL , TRUE , " Global//SplitLoaf" );
42- if (!hMutex) {
41+ if (! hMutex) {
4342 MessageBoxA (NULL , " Failed to create mutex." , " Error" , MB_OK | MB_ICONERROR);
4443 return 1 ;
4544 }
4645
4746 if (GetLastError () == ERROR_ALREADY_EXISTS) {
4847 MessageBoxA (NULL , " Split Loaf is already running." , " Info" , MB_OK | MB_ICONINFORMATION);
4948 CloseHandle (hMutex);
50- return 0 ; // exit this duplicate instance
49+ return 0 ;
5150 }
5251
5352 g_hInstance = GetModuleHandle (NULL );
@@ -62,8 +61,8 @@ int RunWindowsApp() {
6261
6362 HWND hwnd = CreateWindowEx (0 , WINDOW_CLASS, " Split Loaf" , 0 , 0 , 0 , 0 , 0 , NULL , NULL , g_hInstance, NULL );
6463
65- InitTrayIcon (hwnd); // System Tray icon
66- Platform::init (); // Start main program
64+ InitTrayIcon (hwnd);
65+ Platform::init ();
6766
6867 MSG msg{};
6968 while (true ) {
@@ -82,7 +81,6 @@ int RunWindowsApp() {
8281 }
8382 }
8483 }
85-
8684 Platform::processEvents ();
8785 }
8886}
0 commit comments