xoblite™ / Blackbox for Windows bb5 | RC6 preview | 0.25.2.14
http://xoblite.net/
Blackbox.h File Reference
#include "API\BBApi.h"
#include "Graphics\BImage.h"
#include "Messaging\Broams.h"
#include "Console\Console.h"
#include "Desktop\Desktop.h"
#include "Dock\Dock.h"
#include "Hotkeys\Hotkeys.h"
#include "Menu\MenuCommon.h"
#include "Menu\Menu.h"
#include "Menu\PreviewItem.h"
#include "Messaging\MessageManager.h"
#include "Plugins\PluginManager.h"
#include "Toolbar\Taskbar.h"
#include "Toolbar\Toolbar.h"
#include "Workspaces\Workspaces.h"
#include "Settings\Themes.h"
#include "Dialogs\PopupDialog.h"
#include "Settings\Settings.h"
#include "Sounds\Sounds.h"
#include "Desktop\Wallpaper.h"
#include "Resources\resource.h"
#include <process.h>
#include <commdlg.h>
#include <time.h>
#include <shlobj.h>
#include <locale.h>

Macros

#define SESSION_DURATION_TIMER   1
 
#define CHECK_EXPLORER_HIDDEN_TIMER   2
 
#define CHECK_FOR_UPDATES_DELAY_TIMER   3
 

Functions

LRESULT CALLBACK MainWndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
LRESULT CALLBACK ShellHookProc (int nCode, WPARAM wParam, LPARAM lParam)
 
void startBlackbox ()
 
void exitBlackbox ()
 
void restartBlackboxStop ()
 
void restartBlackboxStart ()
 
void ExecuteRootCommand (void *)
 
void ShutdownWindows (int state, bool skipAsking)
 
void ShutdownThread (void *)
 
void HideDesktopIcons (bool hide)
 
void SessionTimeStamp (bool beginSession)
 
void CheckForUpdates ()
 

Macro Definition Documentation

◆ SESSION_DURATION_TIMER

#define SESSION_DURATION_TIMER   1

◆ CHECK_EXPLORER_HIDDEN_TIMER

#define CHECK_EXPLORER_HIDDEN_TIMER   2

◆ CHECK_FOR_UPDATES_DELAY_TIMER

#define CHECK_FOR_UPDATES_DELAY_TIMER   3

Function Documentation

◆ MainWndProc()

LRESULT CALLBACK MainWndProc ( HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam )
800{
801 switch (uMsg)
802 {
803 //====================
804
805 case WM_HELP:
806 {
807 BBExecute(GetDesktopWindow(), NULL, "http://xoblite.net/docs/", "", "", SW_SHOWNORMAL, true);
808 return TRUE;
809 }
810
811 //====================
812
813 case WM_HOTKEY:
814 {
815 if (pHotkeys) pHotkeys->ExecuteHotkey((int)wParam);
816 }
817 break;
818
819 //====================
820
821 case WM_QUERYENDSESSION:
822 {
823 if (lParam & ENDSESSION_CRITICAL)
824 {
825 if (lParam & ENDSESSION_LOGOFF) debugLogoff = true;
826 else debugShutdown = debugReboot = true;
827 if (pSettings->debugLogging) Log("xoblite", "WM_QUERYENDSESSION | SYSTEM/CRITICAL");
828 return TRUE;
829 }
831 {
832 if (pSettings->debugLogging)
833 {
834 if (debugLogoff) Log("xoblite", "WM_QUERYENDSESSION | XOBLITE/LOGOFF");
835 else if (debugReboot) Log("xoblite", "WM_QUERYENDSESSION | XOBLITE/REBOOT");
836 else Log("xoblite", "WM_QUERYENDSESSION | XOBLITE/SHUTDOWN");
837 }
838 return TRUE;
839 }
840 else
841 {
842 if (pSettings->debugLogging)
843 {
844 if (lParam & ENDSESSION_CLOSEAPP) Log("xoblite", "WM_QUERYENDSESSION | SYSTEM/CLOSEAPP");
845 else if (lParam & ENDSESSION_LOGOFF) Log("xoblite", "WM_QUERYENDSESSION | SYSTEM/LOGOFF");
846 else Log("xoblite", "WM_QUERYENDSESSION | SYSTEM/SHUTDOWN_or_REBOOT");
847 }
848/*
849 if (pSettings->debugLogging)
850 {
851 if (MessageBox(GetBBWnd(), "Windows has requested a logoff/reboot/shutdown. \n\nAre you sure you want to quit? \n", "xoblite", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_TOPMOST) != IDYES)
852 {
853 Log("xoblite", "WM_QUERYENDSESSION | === BLOCKED BY USER ===");
854 return FALSE;
855 }
856 }
857*/
858 }
859
860 if (lParam & ENDSESSION_LOGOFF) debugLogoff = true;
861 else debugShutdown = debugReboot = true;
862// PostMessage(hMainWnd, WM_CLOSE, 0, 0);
863 return TRUE;
864 }
865
866 case WM_ENDSESSION:
867 {
868 if ((wParam == TRUE) && pSettings->debugLogging) Log("xoblite", "WM_ENDSESSION");
869// exitBlackbox();
870 return 0;
871 }
872
873 //====================
874
875 case WM_SYSCOMMAND:
876 case WM_KEYDOWN:
877 {
878 if (wParam == SC_CLOSE)
879 {
880 if (pSettings->debugLogging) Log("xoblite", "SC_CLOSE");
881 PostMessage(GetBBWnd(), BB_SHUTDOWN, 255, 0); // Open the standard Windows shutdown menu...
882 return 0;
883 }
884 else return DefWindowProc(hWnd, uMsg, wParam, lParam);
885 }
886
887 //====================
888
889 case WM_CLOSE:
890 case BB_QUIT:
891 {
892 if (pSettings->debugLogging && (uMsg==WM_CLOSE)) Log("xoblite", "SC_CLOSE");
893 exitBlackbox();
894 PostQuitMessage(0);
895 }
896 break;
897
898 //====================
899
900 case BB_SHUTDOWN:
901 {
902 switch (wParam)
903 {
904 case 0: // Shutdown
905 ShutdownWindows(0, ((int)lParam == 1));
906 break;
907 case 1: // Reboot
908 ShutdownWindows(1, ((int)lParam == 1));
909 break;
910 case 2: // Log off
911 ShutdownWindows(2, ((int)lParam == 1));
912 break;
913 case 3: // Hibernate (a.k.a. "safe sleep" and "suspend to disk")
914 ShutdownWindows(3, ((int)lParam == 1));
915 break;
916 case 4: // Standby (a.k.a. "sleep" and "suspend to RAM")
917 ShutdownWindows(4, ((int)lParam == 1));
918 break;
919 case 5: // LockWorkstation
920// BBExecute(GetDesktopWindow(), NULL, "rundll32.exe", "user32.dll,LockWorkStation", NULL, SW_HIDE, false);
921 LockWorkStation();
923 break;
924 default: // Standard Windows shutdown menu (does not work from the xoblite main menu)
926 break;
927 }
928 return 0;
929 }
930
931 //====================
932
933 case BB_RESTART:
934 {
935 if (exitInProgress) // Restart after a failed shutdown/reboot/etc attempt...
936 {
937 exitInProgress = false;
939 }
940 else if (!pausedRestart) // Regular restart...
941 {
942 // Lock the dock to avoid repeated SLIT_REMOVE/ADD
943 // messages from plugins when restarting...
944 pDock->ReconfigureLock(true);
945 if (wParam) pausedRestart = true;
948 SendMessage(pDesktop->hDesktopWnd, BB_RECONFIGURE, 0, 0);
949 }
950 }
951 break;
952
953 //====================
954
955 case BB_SETTHEME: // Introducing xoblite *THEMES*! :D
956 {
957 if (lParam != 0)
958 {
959 char themePath[MAX_LINE_LENGTH];
960 strcpy_s(themePath, (LPCSTR)lParam);
961 SetTheme(themePath, false);
962 }
963 }
964 break;
965
966 //====================
967
968 case BB_SETSTYLE:
969 {
970 // Load a new style or refresh the current one?
971 if (lParam != 0)
972 {
973 char style[MAX_LINE_LENGTH];
974 strcpy_s(style, (LPCSTR)lParam);
975 if (strchr(style, '\"')) StrRemoveEncap(style);
976 if (strchr(style, '$')) ReplaceShellFolders(style);
977 if (strchr(style, '%')) ReplaceEnvVars(style);
978
979 if (!FileExists(style))
980 {
981 MBoxErrorFile(style);
982 break;
983 }
984 stylePath(style); // Save the new style path to blackbox.rc etc.
985 }
986
987 // Read the new style settings...
988 pSettings->ReadStyle();
989
990 // Show style change message in the console...
991 char msg[MAX_LINE_LENGTH], a1[MAX_LINE_LENGTH], a2[MAX_LINE_LENGTH]; // , a3[MAX_LINE_LENGTH];
992 strcpy_s(a1, ReadString(pSettings->styleFile, "style.name:", "[Style name not specified]"));
993 strcpy_s(a2, ReadString(pSettings->styleFile, "style.author:", "[Author not specified]"));
994// strcpy_s(a3, ReadString(pSettings->styleFile, "style.wallpaper:", ""));
995// if (strlen(a3)) sprintf(msg, "Applying \"%s\" by %s... (suggested wallpaper -> %s )", a1, a2, a3);
996// else sprintf(msg, "Applying \"%s\" by %s...", a1, a2);
997 sprintf(msg, "Applying \"%s\" by %s...", a1, a2);
998 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)msg);
999
1000 // Update global menu settings (item heights, fonts...)
1001 pMenuCommon->Configure();
1002
1003 // Temporarily lock the dock to avoid repeated SLIT_UPDATE messages from plugins... (i.e. repeated repaints of the dock window)
1004 pDock->ReconfigureLock(true);
1005
1006 // Reconfigure...
1007 SendMessage(GetBBWnd(), BB_RECONFIGURE, 0, 0);
1008
1009 // As a "security precausion", we also move the desktop window to the bottom...
1010// SetWindowPos(pDesktop->hDesktopWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOSENDCHANGING);
1011 SetWindowPos(pDesktop->hDesktopWnd, GetDesktopWindow(), 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOSENDCHANGING);
1012
1013 // Finally, we execute the rootCommand (nb. only "bsetbg" or "bsetroot", now internally parsed, allowed!) in a separate thread...
1014 if (!wParam && !pSettings->disableRootCommands) _beginthread(ExecuteRootCommand, 0, NULL);
1015
1016 pSettings->Statistics.changedStyle++; // Update statistics...
1017 }
1018 break;
1019
1020 //====================
1021
1022 case WM_DISPLAYCHANGE:
1023 {
1024 if (!pSettings->disableRootCommands) _beginthread(ExecuteRootCommand, 0, NULL); // Refresh the desktop wallpaper by re-running the current style's rootCommand...
1025 }
1026 break;
1027
1028 //====================
1029
1030 case WM_DPICHANGED:
1031 {
1032 int dpiValue = (int)LOWORD(wParam);
1033 int scaleFactor = 0;
1034
1035 switch (dpiValue)
1036 {
1037 case 384: { scaleFactor = 400; } break; // 384 DPI -> 400%
1038 case 336: { scaleFactor = 350; } break; // 336 DPI -> 350%
1039 case 288: { scaleFactor = 300; } break; // 288 DPI -> 300%
1040 case 240: { scaleFactor = 250; } break; // 240 DPI -> 250%
1041 case 216: { scaleFactor = 225; } break; // 216 DPI -> 225%
1042 case 192: { scaleFactor = 200; } break; // 192 DPI -> 200%
1043 case 168: { scaleFactor = 175; } break; // 168 DPI -> 175%
1044 case 144: { scaleFactor = 150; } break; // 144 DPI -> 150%
1045 case 120: { scaleFactor = 125; } break; // 120 DPI -> 125%
1046 case 96: { scaleFactor = 100; } break; // 96 DPI -> 100%
1047 default: break; // Unknown DPI value
1048 }
1049
1050 char msg[350];
1051 if (scaleFactor > 0) sprintf(msg, "Windows UI scaling factor has changed to %d%%. xoblite HiDPI scaling factor is set to %dx. ", scaleFactor, pSettings->scalingFactorHiDPI);
1052 else sprintf(msg, "Windows UI scaling resolution has changed to %d DPI. xoblite HiDPI scaling factor is set to %dx. ", dpiValue, pSettings->scalingFactorHiDPI);
1053 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)msg);
1054
1055 return 0;
1056 }
1057
1058 //====================
1059
1060 case BB_EDITFILE:
1061 {
1062 switch (wParam)
1063 {
1064 case 0: // Open the current style file for editing
1065 BBExecute(GetDesktopWindow(), NULL, pSettings->preferredEditor, pSettings->styleFile, NULL, SW_SHOWNORMAL, false);
1066 break;
1067 case 1: // Open the current menu.rc file for editing
1068 BBExecute(GetDesktopWindow(), NULL, pSettings->preferredEditor, pSettings->menuFile, NULL, SW_SHOWNORMAL, false);
1069 break;
1070 case 2: // Open the current plugins.rc file for editing
1071 BBExecute(GetDesktopWindow(), NULL, pSettings->preferredEditor, pSettings->pluginsFile, NULL, SW_SHOWNORMAL, false);
1072 break;
1073 case 3: // Open the current theme's xoblite.rc (or if used, legacy extensions.rc) file for editing
1074 BBExecute(GetDesktopWindow(), NULL, pSettings->preferredEditor, pSettings->xobrcFile, NULL, SW_SHOWNORMAL, false);
1075 break;
1076 case 4: // Open the default xoblite.rc (or if used, legacy blackbox.rc) file for editing
1077 BBExecute(GetDesktopWindow(), NULL, pSettings->preferredEditor, pSettings->xobrcDefaultFile, NULL, SW_SHOWNORMAL, false);
1078 break;
1079 default:
1080 break;
1081 }
1082 return 0;
1083 }
1084 break;
1085
1086 //====================
1087
1088 case BB_TOGGLEPLUGINS:
1089 {
1090 if (pSettings->pluginsHidden)
1091 {
1092 SendMessage(hMainWnd, BB_BROADCAST, 0, (LPARAM)"@BBShowPlugins");
1093 pSettings->pluginsHidden = false;
1094 }
1095 else
1096 {
1097 SendMessage(hMainWnd, BB_BROADCAST, 0, (LPARAM)"@BBHidePlugins");
1098 pSettings->pluginsHidden = true;
1099 }
1100
1101 // Move the console->dock->toolbar, if not hidden, back to the top... (i.e. so they're not covered by any non-alwaysontop plugins)
1102 if (!pSettings->consoleHidden) SetForegroundWindow(pConsole->hConsoleWnd);
1103 if (!pSettings->dockHidden) SetForegroundWindow(pDock->hDockWnd);
1104 if (!pSettings->toolbarHidden) SetForegroundWindow(pToolbar->hToolbarWnd);
1105
1106 WriteBool(pSettings->xobrcFile, "xoblite.plugins.hidden:", pSettings->pluginsHidden);
1107 }
1108 break;
1109
1110 //====================
1111
1112 case BB_RUN: // This is called e.g. from a menu [run] item...
1113 {
1114 if ((int)lParam == 1) BBSmartExecute("@xoblite Run"); // -> The xoblite super-powered run box... (i.e. this includes support for bro@ms, @script as well as regular commands, but lacks a "Browse..." function etc)
1115 else RunDlg( NULL, NULL, NULL, NULL, NULL, 0 ); // -> The regular Windows run dialog... (i.e. this lacks support for bro@ms and @script of course, but has a "Browse..." function etc)
1116 }
1117 break;
1118
1119 case WM_CTLCOLOREDIT: // Used by the xoblite run box edit window... (nb. for menu string item edit windows this is handled by the item's parent menu)
1120 {
1121 // SetTextColor((HDC)wParam, pSettings->Toolbar->TextColor);
1122 // SetBkColor((HDC)wParam, pSettings->Toolbar->Color);
1123 SetTextColor((HDC)wParam, 0x000000);
1124 SetBkColor((HDC)wParam, 0xffffff);
1125 return (LRESULT)GetStockObject(NULL_BRUSH);
1126 }
1127 break;
1128
1129 //====================
1130
1131 case BB_REGISTERMESSAGE:
1132 {
1133 UINT *msgArray = (UINT*)lParam;
1134 for (int size = 0; msgArray[size] != 0; size++)
1135 {
1136 pMessageManager->AddMessage(msgArray[size], (HWND)wParam);
1137 }
1138 break;
1139 }
1140
1142 {
1143 UINT *msgArray = (UINT*)lParam;
1144 for (int size = 0; msgArray[size] != 0; size++)
1145 {
1146 pMessageManager->RemoveMessage(msgArray[size], (HWND)wParam);
1147 }
1148 break;
1149 }
1150
1151 //====================
1152
1153 case WM_COPYDATA: // Used by Blackbox.exe -broam <string>
1154 {
1155 PCOPYDATASTRUCT pcds = (PCOPYDATASTRUCT)lParam;
1156 if (pcds->dwData == BB_BROADCAST) SendMessage(GetBBWnd(), BB_BROADCAST, 0, (LPARAM)pcds->lpData);
1157 else if (pcds->dwData == BB_SETSTYLE) PostMessage(GetBBWnd(), BB_SETSTYLE, 0, (LPARAM)pcds->lpData);
1158 break;
1159 }
1160
1161 //====================
1162
1163 case WM_DROPFILES:
1164 {
1165 // Forward any drag'n'drop messages to the Desktop for parsing...
1166 if (pDesktop) return PostMessage(pDesktop->hDesktopWnd, WM_DROPFILES, wParam, lParam);
1167 }
1168 break;
1169
1170 //====================
1171
1172 case WM_TIMER:
1173 {
1174 // CHECK_EXPLORER_HIDDEN_TIMER:
1175 // -> Timer to check whether the Explorer taskbar has gone visible again,
1176 // despite having been previously hidden... (read: I'm not 100% sure why/when
1177 // this happens yet, so continuously checking is more "foolproof" for now ;) )
1178 if (wParam == CHECK_EXPLORER_HIDDEN_TIMER)
1179 {
1180 if (pSettings->explorerHidden)
1181 {
1182 if (pSettings->underExplorer && IsWindowVisible(FindWindow("Shell_TrayWnd", NULL)))
1183 {
1184 HideExplorer(true);
1185 HideDesktopIcons(true);
1186 }
1187 }
1188 }
1189
1190 // SESSION_DURATION_TIMER:
1191 // -> Timer to measure the length of the session in minutes...
1192 // (used to calculate the duration of the session when it ends)
1193 else if (wParam == SESSION_DURATION_TIMER) sessionDuration++;
1194
1195 // CHECK_FOR_UPDATES_DELAY_TIMER:
1196 // -> On first launch, and when resuming from sleep/hibernate,
1197 // we perform a check for updates, but only after a certain delay
1198 // to allow all other things as well as the user to warm up first... ;)
1199 else if (wParam == CHECK_FOR_UPDATES_DELAY_TIMER)
1200 {
1203 }
1204
1205 return 0;
1206 }
1207
1208 //====================
1209
1210 case BB_BROADCAST:
1211 {
1212 char broam[MAX_LINE_LENGTH];
1213 strcpy_s(broam, (LPCSTR)lParam);
1214 if (ExecuteBroam(broam, hMainInstance)) return 0;
1215 }
1216
1217 //====================
1218
1219 case BB_TRAYICONMESSAGE:
1220 {
1221 switch (LOWORD(lParam))
1222 {
1223 case WM_LBUTTONUP:
1224 {
1225 if ((GetAsyncKeyState(VK_CONTROL) & 0x8000) && pWorkspaces) pWorkspaces->NextWorkspace();
1226 else if (pToolbar)
1227 {
1228// pToolbar->UpdatePosition();
1229 SetWindowPos(pToolbar->hToolbarWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
1230 SetForegroundWindow(pToolbar->hToolbarWnd);
1232 }
1233 break;
1234 }
1235
1236 case WM_RBUTTONDOWN:
1237 {
1238 if ((GetAsyncKeyState(VK_CONTROL) & 0x8000) && pWorkspaces) pWorkspaces->PreviousWorkspace();
1239 else if (pTaskbar) pTaskbar->MinimizeAllWindows();
1240 break;
1241 }
1242
1243 case WM_MOUSEWHEEL: // TEMPORARY "FOR TESTING" PLACEHOLDER
1244 {
1246 break;
1247 }
1248
1249 default: { break; }
1250 }
1251 }
1252
1253 //====================
1254
1255 default:
1256 {
1257 if (uMsg == WM_TASKBARCREATED_MESSAGE)
1258 {
1259 if (pSettings->underExplorer)
1260 {
1261 // The Explorer system tray has been recreated (e.g. due to Explorer crashing), so we need to re-add the xoblite icon to the system tray...
1262 DestroyIcon(xobIconData.hIcon);
1263 ZeroMemory(&xobIconData, sizeof(NOTIFYICONDATA));
1264 xobIconData.cbSize = sizeof(NOTIFYICONDATA); // Older Windows versions -> NOTIFYICONDATA_V3_SIZE
1265 xobIconData.hIcon = LoadIcon(hMainInstance, MAKEINTRESOURCE(IDI_XOBLITE));
1266// LoadIconMetric(hMainInstance, MAKEINTRESOURCE(IDI_XOBLITE), LIM_SMALL, &(xobIconData.hIcon));
1267 strcpy(xobIconData.szTip, "xoblite");
1268 xobIconData.hWnd = GetBBWnd();
1269 xobIconData.uID = 0;
1270 xobIconData.uVersion = NOTIFYICON_VERSION_4; // // Older Windows versions -> 3
1271 xobIconData.uCallbackMessage = BB_TRAYICONMESSAGE;
1272 xobIconData.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
1273 Shell_NotifyIcon(NIM_ADD, &xobIconData);
1274 }
1275 return 0;
1276 }
1277
1278 //====================
1279
1280 if (pMessageManager)
1281 {
1282 unsigned int shellMessage = uMsg;
1283 WPARAM replaceParam = wParam;
1284
1285 if (shellMessage == WM_SHELLHOOKMESSAGE)
1286 {
1287 if (wParam == HSHELL_WINDOWCREATED) shellMessage = BB_ADDTASK;
1288 else if (wParam == HSHELL_WINDOWDESTROYED) shellMessage = BB_REMOVETASK;
1289 else if (wParam == HSHELL_ACTIVATESHELLWINDOW) shellMessage = BB_ACTIVATESHELLWINDOW;
1290 else if (wParam == HSHELL_WINDOWACTIVATED) shellMessage = BB_ACTIVETASK;
1291 else if (wParam == HSHELL_RUDEAPPACTIVATED)
1292 {
1293 // Could there be a better way to support fullscreen windows?
1294 // (e.g. unloading everything or disable alwaysontop elements)
1295 shellMessage = BB_ACTIVETASK;
1296/*
1297 if (pTaskbar)
1298 {
1299 HWND window = (HWND)lParam;
1300 if (pTaskbar->FindTask(window) >= 0) shellMessage = BB_ACTIVETASK;
1301 else shellMessage = BB_ADDTASK;
1302 }
1303 else shellMessage = BB_ACTIVETASK;
1304
1305 if (pSettings->debugLogging && pTaskbar)
1306 {
1307 char msg[MAX_LINE_LENGTH], windowText[MAX_LINE_LENGTH], windowClass[MAX_LINE_LENGTH];
1308 GetWindowText((HWND)lParam, windowText, sizeof(windowText));
1309 if (!strlen(windowText)) strcpy(windowText, "NULL");
1310 GetClassName((HWND)lParam, windowClass, sizeof(windowClass));
1311 if (!strlen(windowClass)) strcpy(windowClass, "NULL");
1312 sprintf(msg, "WM_SHELLHOOKMESSAGE -> HSHELL_RUDEAPPACTIVATED -> %s | %s | Already on taskbar: ", windowText, windowClass);
1313 HWND window = (HWND)lParam;
1314 if (pTaskbar->FindTask(window) >= 0) strcat(msg, "Yes");
1315 else strcat(msg, "No");
1316
1317 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)msg);
1318 Log("xoblite", msg);
1319 }
1320*/
1321 }
1322 else if (wParam == HSHELL_GETMINRECT) shellMessage = BB_MINMAXTASK;
1323 else if (wParam == HSHELL_REDRAW) shellMessage = BB_REDRAW;
1324 else if (wParam == HSHELL_FLASH)
1325 {
1326 // Insert flashing code here...
1327 shellMessage = BB_REDRAW;
1328 pTaskbar->flashingHwnd = (HWND)lParam;
1329 }
1330 else // -> Unsupported HSHELL message received!
1331 {
1332/*
1333 if (pSettings->debugLogging)
1334 {
1335 char msg[MAX_LINE_LENGTH], windowText[MAX_LINE_LENGTH], windowClass[MAX_LINE_LENGTH];
1336 GetWindowText((HWND)lParam, windowText, sizeof(windowText));
1337 if (!strlen(windowText)) strcpy(windowText, "NULL");
1338 GetClassName((HWND)lParam, windowClass, sizeof(windowClass));
1339 if (!strlen(windowClass)) strcpy(windowClass, "NULL");
1340
1341 if (wParam == HSHELL_TASKMAN) strcpy(msg, "Unsupported HSHELL message -> HSHELL_TASKMAN");
1342 else if (wParam == HSHELL_LANGUAGE) strcpy(msg, "Unsupported HSHELL message -> HSHELL_LANGUAGE");
1343 else if (wParam == HSHELL_SYSMENU) strcpy(msg, "Unsupported HSHELL message -> HSHELL_SYSMENU");
1344 else if (wParam == HSHELL_ENDTASK) sprintf(msg, "Unsupported HSHELL message -> HSHELL_ENDTASK -> %s | %s", windowText, windowClass);
1345 else if (wParam == HSHELL_ACCESSIBILITYSTATE) strcpy(msg, "Unsupported HSHELL message -> HSHELL_ACCESSIBILITYSTATE");
1346 else if (wParam == HSHELL_APPCOMMAND) strcpy(msg, "Unsupported HSHELL message -> HSHELL_APPCOMMAND");
1347 else if (wParam == HSHELL_WINDOWREPLACED) sprintf(msg, "Unsupported HSHELL message -> HSHELL_WINDOWREPLACED -> %s | %s", windowText, windowClass);
1348 else if (wParam == HSHELL_WINDOWREPLACING) sprintf(msg, "Unsupported HSHELL message -> HSHELL_WINDOWREPLACING -> %s | %s", windowText, windowClass);
1349 else if (wParam == HSHELL_MONITORCHANGED) sprintf(msg, "Unsupported HSHELL message -> HSHELL_MONITORCHANGED -> %s | %s", windowText, windowClass);
1350 else sprintf(msg, "Unknown HSHELL message -> 0x%lx -> %s | %s", (LONG)wParam, windowText, windowClass);
1351
1352 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)msg);
1353 Log("xoblite", msg);
1354 }
1355*/
1356 return DefWindowProc(hWnd, uMsg, wParam, lParam);
1357 }
1358
1359 replaceParam = (WPARAM)lParam; // Replacement wParam set to the hwnd
1360 }
1361
1362 //====================
1363
1364 if (pMessageManager->HandlerExists(shellMessage))
1365 {
1366 LRESULT lResult;
1367 if (pMessageManager->SendMessage(shellMessage, replaceParam, lParam, &lResult)) return lResult;
1368 }
1369 }
1370
1371 return DefWindowProc(hWnd, uMsg, wParam, lParam);
1372 }
1373
1374 //====================
1375 }
1376
1377 return DefWindowProc(hWnd, uMsg, wParam, lParam);
1378}
void WriteBool(LPCSTR fp, LPCSTR keyword, bool value)
Definition BBApi.cpp:3131
Desktop * pDesktop
Definition Blackbox.cpp:37
Workspaces * pWorkspaces
Definition Blackbox.cpp:51
int MBoxErrorFile(LPCSTR szFile)
Definition BBApi.cpp:1612
Taskbar * pTaskbar
Definition Blackbox.cpp:47
LPSTR ReadString(LPCSTR fp, LPCSTR szString, LPSTR szDefault)
Definition BBApi.cpp:544
void BBSmartExecute(LPSTR inputString)
Definition BBApi.cpp:1767
MenuCommon * pMenuCommon
Definition Blackbox.cpp:41
bool FileExists(LPCSTR szFileName)
Definition BBApi.cpp:819
LPCSTR stylePath(LPCSTR other)
Definition BBApi.cpp:959
LPSTR StrRemoveEncap(LPSTR string)
Definition BBApi.cpp:406
void Log(LPCSTR des, LPCSTR line)
Definition BBApi.cpp:638
HINSTANCE BBExecute(HWND Owner, LPCSTR szOperation, LPCSTR szCommand, LPCSTR szArgs, LPCSTR szDirectory, int nShowCmd, bool noErrorMsgs)
Definition BBApi.cpp:1648
void ReplaceEnvVars(LPSTR string)
Definition BBApi.cpp:2594
void ReplaceShellFolders(LPSTR string)
Definition BBApi.cpp:2633
Settings * pSettings
Definition Blackbox.cpp:46
HWND GetBBWnd()
Definition BBApi.cpp:128
#define BB_SHUTDOWN
Definition BBApi.h:175
#define BB_QUIT
Definition BBApi.h:145
#define BB_ACTIVETASK
Definition BBApi.h:198
#define BB_REGISTERMESSAGE
Definition BBApi.h:142
#define BB_RUN
Definition BBApi.h:176
#define BB_RESTART
Definition BBApi.h:146
#define BB_CONSOLEMESSAGE
Definition BBApi.h:165
#define BB_TOGGLEPLUGINS
Definition BBApi.h:167
#define CONSOLE_REGULAR_MESSAGE
Definition BBApi.h:297
#define BB_TRAYICONMESSAGE
Definition BBApi.h:247
#define BB_BROADCAST
Definition BBApi.h:245
#define BB_RECONFIGURE
Definition BBApi.h:147
#define BB_ADDTASK
Definition BBApi.h:195
#define BB_REDRAW
Definition BBApi.h:200
#define BB_SETTHEME
Definition BBApi.h:151
#define BB_MINMAXTASK
Definition BBApi.h:199
#define BB_UNREGISTERMESSAGE
Definition BBApi.h:143
#define BB_SETSTYLE
Definition BBApi.h:148
#define BB_ACTIVATESHELLWINDOW
Definition BBApi.h:197
#define BB_REMOVETASK
Definition BBApi.h:196
#define BB_EDITFILE
Definition BBApi.h:155
#define MAX_LINE_LENGTH
Definition BBApi.h:64
#define CONSOLE_INFORMATION_MESSAGE
Definition BBApi.h:298
Hotkeys * pHotkeys
Definition Blackbox.cpp:39
#define ENDSESSION_CRITICAL
Definition Blackbox.cpp:129
bool exitInProgress
Definition Blackbox.cpp:73
Toolbar * pToolbar
Definition Blackbox.cpp:48
void restartBlackboxStart()
Definition Blackbox.cpp:703
NOTIFYICONDATA xobIconData
Definition Blackbox.cpp:67
bool debugReboot
Definition Blackbox.cpp:76
void restartBlackboxStop()
Definition Blackbox.cpp:680
HWND hMainWnd
Definition Blackbox.cpp:62
bool debugLogoff
Definition Blackbox.cpp:75
RUNDLGPROC RunDlg
Definition Blackbox.cpp:88
void ExecuteRootCommand(void *)
Definition Blackbox.cpp:1519
void ShutdownWindows(int state, bool skipAsking)
Definition Blackbox.cpp:1552
Console * pConsole
Definition Blackbox.cpp:36
HINSTANCE hMainInstance
Definition Blackbox.cpp:61
Dock * pDock
Definition Blackbox.cpp:38
void startBlackbox()
Definition Blackbox.cpp:449
unsigned int WM_SHELLHOOKMESSAGE
Definition Blackbox.cpp:120
void HideDesktopIcons(bool hide)
Definition Blackbox.cpp:1709
int sessionDuration
Definition Blackbox.cpp:79
bool pausedRestart
Definition Blackbox.cpp:71
bool debugShutdown
Definition Blackbox.cpp:77
MessageManager * pMessageManager
Definition Blackbox.cpp:42
#define ENDSESSION_CLOSEAPP
Definition Blackbox.cpp:126
static UINT WM_TASKBARCREATED_MESSAGE
Definition Blackbox.cpp:69
void CheckForUpdates()
Definition Blackbox.cpp:1804
MSWINSHUTDOWNPROC MSWinShutdown
Definition Blackbox.cpp:86
void exitBlackbox()
Definition Blackbox.cpp:630
#define CHECK_EXPLORER_HIDDEN_TIMER
Definition Blackbox.h:64
#define CHECK_FOR_UPDATES_DELAY_TIMER
Definition Blackbox.h:65
#define SESSION_DURATION_TIMER
Definition Blackbox.h:63
void HideExplorer(bool hideOnStartup)
Definition Broams.cpp:2589
bool ExecuteBroam(LPSTR broam, HINSTANCE hMainInstance)
Definition Broams.cpp:56
void PlaySoundFX(int sound)
Definition Sounds.cpp:40
@ SFX_LOCK_WORKSTATION
Definition Sounds.h:61
@ SFX_MENU_CLICK
Definition Sounds.h:45
@ SFX_MENU_NAVIGATE
Definition Sounds.h:43
bool SetTheme(LPSTR themePath, bool startingUp)
Definition Themes.cpp:47

◆ ShellHookProc()

LRESULT CALLBACK ShellHookProc ( int nCode,
WPARAM wParam,
LPARAM lParam )
1386{
1387 if (nCode < 0)
1388 {
1389 if (pSettings->debugLogging) Log("DEBUG -> ShellHookProc -> nCode < 0 (i.e. \"do not process this message\")", "");
1390 return CallNextHookEx(shellHook, nCode, wParam, lParam);
1391 }
1392
1393 if (pSettings->debugLogging)
1394 {
1395 char msg[MAX_LINE_LENGTH];
1396 switch (nCode)
1397 {
1398 case HSHELL_WINDOWCREATED: { strcpy(msg, "DEBUG -> ShellHookProc -> HSHELL_WINDOWCREATED"); break; }
1399 case HSHELL_WINDOWDESTROYED: { strcpy(msg, "DEBUG -> ShellHookProc -> HSHELL_WINDOWDESTROYED"); break; }
1400 case HSHELL_ACTIVATESHELLWINDOW: { strcpy(msg, "DEBUG -> ShellHookProc -> HSHELL_ACTIVATESHELLWINDOW"); break; }
1401 case HSHELL_WINDOWACTIVATED: { strcpy(msg, "DEBUG -> ShellHookProc -> HSHELL_WINDOWACTIVATED"); break; }
1402 case HSHELL_GETMINRECT: { strcpy(msg, "DEBUG -> ShellHookProc -> HSHELL_GETMINRECT"); break; }
1403 case HSHELL_REDRAW: { strcpy(msg, "DEBUG -> ShellHookProc -> HSHELL_REDRAW"); break; }
1404 case HSHELL_TASKMAN: { strcpy(msg, "DEBUG -> ShellHookProc -> HSHELL_TASKMAN"); break; }
1405 case HSHELL_LANGUAGE: { strcpy(msg, "DEBUG -> ShellHookProc -> HSHELL_LANGUAGE"); break; }
1406
1407 case HSHELL_ACCESSIBILITYSTATE: { strcpy(msg, "DEBUG -> ShellHookProc -> HSHELL_ACCESSIBILITYSTATE"); break; }
1408 case HSHELL_APPCOMMAND: { strcpy(msg, "DEBUG -> ShellHookProc -> HSHELL_APPCOMMAND"); break; }
1409 case HSHELL_WINDOWREPLACED: { strcpy(msg, "DEBUG -> ShellHookProc -> HSHELL_WINDOWREPLACED"); break; }
1410
1411 default: { sprintf(msg, "DEBUG -> ShellHookProc -> Unknown HSHELL message -> 0x%lx", (LONG)nCode); break; }
1412 }
1413 strcat(msg, " -> Forwarding to the *box internal message bus for further processing.");
1414 PostMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)msg);
1415 Log("xoblite", msg);
1416 }
1417
1418 if (pMessageManager) PostMessage(GetBBWnd(), WM_SHELLHOOKMESSAGE, (WPARAM)nCode, (LPARAM)wParam);
1419
1420 return CallNextHookEx(shellHook, nCode, wParam, lParam);
1421/*
1422 if (pMessageManager)
1423 {
1424 unsigned int shellMessage = nCode;
1425 WPARAM replaceParam = wParam;
1426
1427 //====================
1428
1429 if (nCode == HSHELL_WINDOWCREATED) shellMessage = BB_ADDTASK;
1430 else if (nCode == HSHELL_WINDOWDESTROYED) shellMessage = BB_REMOVETASK;
1431 else if (nCode == HSHELL_ACTIVATESHELLWINDOW) shellMessage = BB_ACTIVATESHELLWINDOW;
1432 else if (nCode == HSHELL_WINDOWACTIVATED) shellMessage = BB_ACTIVETASK;
1433 else if (nCode == HSHELL_RUDEAPPACTIVATED)
1434 {
1435 // Could there be a better way to support fullscreen windows?
1436 // (e.g. unloading everything or disable alwaysontop elements)
1437 shellMessage = BB_ACTIVETASK;
1438
1439// if (pTaskbar)
1440// {
1441// HWND window = (HWND)lParam;
1442// if (pTaskbar->FindTask(window) >= 0) shellMessage = BB_ACTIVETASK;
1443// else shellMessage = BB_ADDTASK;
1444// }
1445// else shellMessage = BB_ACTIVETASK;
1446//
1447// if (pSettings->debugLogging && pTaskbar)
1448// {
1449// char msg[MAX_LINE_LENGTH], windowText[MAX_LINE_LENGTH], windowClass[MAX_LINE_LENGTH];
1450// GetWindowText((HWND)lParam, windowText, sizeof(windowText));
1451// if (!strlen(windowText)) strcpy(windowText, "NULL");
1452// GetClassName((HWND)lParam, windowClass, sizeof(windowClass));
1453// if (!strlen(windowClass)) strcpy(windowClass, "NULL");
1454// sprintf(msg, "WM_SHELLHOOKMESSAGE -> HSHELL_RUDEAPPACTIVATED -> %s | %s | Already on taskbar: ", windowText, windowClass);
1455// HWND window = (HWND)lParam;
1456// if (pTaskbar->FindTask(window) >= 0) strcat(msg, "Yes");
1457// else strcat(msg, "No");
1458//
1459// SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)msg);
1460// Log("xoblite", msg);
1461// }
1462 }
1463 else if (nCode == HSHELL_GETMINRECT) shellMessage = BB_MINMAXTASK;
1464 else if (nCode == HSHELL_REDRAW) shellMessage = BB_REDRAW;
1465 else if (nCode == HSHELL_FLASH)
1466 {
1467 // Insert flashing code here...
1468 shellMessage = BB_REDRAW;
1469 pTaskbar->flashingHwnd = (HWND)lParam;
1470 }
1471 else // -> Unsupported HSHELL message received!
1472 {
1473 if (pSettings->debugLogging)
1474 {
1475 char msg[MAX_LINE_LENGTH], windowText[MAX_LINE_LENGTH], windowClass[MAX_LINE_LENGTH];
1476 GetWindowText((HWND)wParam, windowText, sizeof(windowText));
1477 if (!strlen(windowText)) strcpy(windowText, "NULL");
1478 GetClassName((HWND)wParam, windowClass, sizeof(windowClass));
1479 if (!strlen(windowClass)) strcpy(windowClass, "NULL");
1480
1481 if (nCode == HSHELL_TASKMAN) strcpy(msg, "Unsupported HSHELL message -> HSHELL_TASKMAN");
1482 else if (nCode == HSHELL_LANGUAGE) strcpy(msg, "Unsupported HSHELL message -> HSHELL_LANGUAGE");
1483 else if (nCode == HSHELL_SYSMENU) strcpy(msg, "Unsupported HSHELL message -> HSHELL_SYSMENU");
1484 else if (nCode == HSHELL_ENDTASK) sprintf(msg, "Unsupported HSHELL message -> HSHELL_ENDTASK -> %s | %s", windowText, windowClass);
1485 else if (nCode == HSHELL_ACCESSIBILITYSTATE) strcpy(msg, "Unsupported HSHELL message -> HSHELL_ACCESSIBILITYSTATE");
1486 else if (nCode == HSHELL_APPCOMMAND) strcpy(msg, "Unsupported HSHELL message -> HSHELL_APPCOMMAND");
1487 else if (nCode == HSHELL_WINDOWREPLACED) sprintf(msg, "Unsupported HSHELL message -> HSHELL_WINDOWREPLACED -> %s | %s", windowText, windowClass);
1488 else if (nCode == HSHELL_WINDOWREPLACING) sprintf(msg, "Unsupported HSHELL message -> HSHELL_WINDOWREPLACING -> %s | %s", windowText, windowClass);
1489 else if (nCode == HSHELL_MONITORCHANGED) sprintf(msg, "Unsupported HSHELL message -> HSHELL_MONITORCHANGED -> %s | %s", windowText, windowClass);
1490 else sprintf(msg, "Unknown HSHELL message -> 0x%lx -> %s | %s", (LONG)nCode, windowText, windowClass);
1491
1492 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)msg);
1493 Log("xoblite", msg);
1494 }
1495
1496 return CallNextHookEx(shellHook, nCode, wParam, lParam);
1497 }
1498
1499 //====================
1500
1501 if (pMessageManager->HandlerExists(shellMessage))
1502 {
1503 if (pSettings->debugLogging) Log("DEBUG -> In ShellHookProc, about to pMessageManager->SendMessage...", "");
1504
1505 LRESULT lResult;
1506 if (pMessageManager->SendMessage(shellMessage, wParam, lParam, &lResult)) return lResult;
1507 }
1508 }
1509
1510 return CallNextHookEx(shellHook, nCode, wParam, lParam);
1511*/
1512}
HHOOK shellHook
Definition Blackbox.cpp:119

◆ startBlackbox()

void startBlackbox ( )
450{
451 // Get the paths to the default xoblite.rc or blackbox.rc/extensions.rc...
452 pSettings->GetShellFolders();
453
454 //====================
455
456 // Read only those settings from the default .rc
457 // that are required to set the correct theme at startup...
458 strcpy_s(pSettings->themesFolder, ReadString(pSettings->xobrcDefaultFile, "xoblite.themesFolder:", "$Blackbox$\\themes"));
459 if (strchr(pSettings->themesFolder, '\"')) StrRemoveEncap(pSettings->themesFolder);
460 if (strchr(pSettings->themesFolder, '$')) ReplaceShellFolders(pSettings->themesFolder);
461 if (strchr(pSettings->themesFolder, '%')) ReplaceEnvVars(pSettings->themesFolder);
462 strcpy_s(pSettings->selectedTheme, ReadString(pSettings->xobrcDefaultFile, "xoblite.selected.theme:", "[Default]"));
463 if (!_stricmp(pSettings->selectedTheme, "<Default>")) strcpy(pSettings->selectedTheme, "[Default]"); // (changed to avoid similarity to editable string/integer menu items, as it is also shown in the Themes menu)
464
465 if (!_stricmp(pSettings->selectedTheme, "[Default]")) // -> Use the default theme...
466 {
467 SetTheme(pSettings->SF_blackboxPath, true);
468 }
469 else // -> Set a specific theme...
470 {
471 char themePath[MAX_PATH];
472 strcpy_s(themePath, pSettings->themesFolder);
473 strcat(themePath, "\\");
474 strcat(themePath, pSettings->selectedTheme);
475 SetTheme(themePath, true);
476 }
477
478 //====================
479
480 // Read configuration settings and style parameters for the chosen theme...
481 pSettings->ReadConfiguration();
482 pSettings->ReadStyle();
484
485 // Set time locale if configured...
486 if (strlen(pSettings->timeDateLocale) > 0) setlocale(LC_TIME, pSettings->timeDateLocale);
487 else setlocale(LC_TIME, ""); // Not configured -> Set the time locale to the user default obtained from the operating system...
488
489 // Should we hide the Explorer taskbar etc already on startup?
490 if (pSettings->underExplorer && pSettings->explorerHidden) HideExplorer(true);
491
492 //====================
493
494 // ####################################################################
495 // ##### Note: The order things are started below is important!!! #####
496 // ####################################################################
497
498 pBImage = new BImage;
501
502 // Display welcome message in the console...
503 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_SHELL_MESSAGE, (LPARAM)"Welcome to xoblite.");
504 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_PLAIN_MESSAGE, (LPARAM)" http://xoblite.net/");
505 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_PLAIN_MESSAGE, (LPARAM)" https://github.com/xoblite/");
506
507 // Set time stamp for beginning of session...
508 Log("----------------------------------------", "");
509 SessionTimeStamp(true);
510/*
511 if (pSettings->debugLogging)
512 {
513 char msg[255];
514 sprintf(msg, "Operating system: %s ", GetOSInfo());
515 if (pSettings->runningUnderWOW64) strcat(msg, "(64-bit).");
516 else strcat(msg, "(32-bit).");
517 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)msg);
518
519// char msg[255];
520// sprintf(msg, "Time locale set to %s.", setlocale(LC_TIME, NULL));
521// SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)msg);
522 }
523*/
524/*
525 if (useLegacyShellHook) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_ERROR_MESSAGE, (LPARAM)"xShellHook .DLL not found (or disabled) -> Falling back to legacy shell hook implementation.");
526 else if (hShellHookDLL != NULL) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"xShellHook .DLL found -> Using alternative new shell hook implementation.");
527 if (pSettings->debugLogging)
528 {
529 if (hShellHookDLL != NULL)
530 {
531 // SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"DEBUG -> xShellHook.dll loaded.");
532 if (PrepareShellHook != NULL) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)"... PrepareShellHook() function found.");
533 if (StartShellHook != NULL) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)"... StartShellHook() function found.");
534 if (StopShellHook != NULL) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)"... StopShellHook() function found.");
535 if (ShellHookProcInDLL != NULL) SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INDENTED_MESSAGE, (LPARAM)"... ShellHookProc() function found.");
536 }
537 }
538*/
542 pDock = new Dock(hMainInstance);
543 pTooltips = new Tooltips();
544 pTaskbar = new Taskbar();
545
549
550 pMenuCommon->Initialize(hMainInstance);
551 pTaskbar->InitializeTaskList(); // Enumerate tasks for the taskbar...
552
554
555 if (pSettings->underExplorer)
556 {
557 // Add the xoblite icon to the system tray... =]
558 ZeroMemory(&xobIconData, sizeof(NOTIFYICONDATA));
559 xobIconData.cbSize = sizeof(NOTIFYICONDATA); // Older Windows versions -> NOTIFYICONDATA_V3_SIZE
560 xobIconData.hIcon = LoadIcon(hMainInstance, MAKEINTRESOURCE(IDI_XOBLITE));
561// LoadIconMetric(hMainInstance, MAKEINTRESOURCE(IDI_XOBLITE), LIM_SMALL, &(xobIconData.hIcon));
562 strcpy(xobIconData.szTip, "xoblite");
563 xobIconData.hWnd = GetBBWnd();
564 xobIconData.uID = 0;
565 xobIconData.uVersion = NOTIFYICON_VERSION_4; // // Older Windows versions -> 3
566 xobIconData.uCallbackMessage = BB_TRAYICONMESSAGE;
567 xobIconData.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE;
568 Shell_NotifyIcon(NIM_ADD, &xobIconData);
569
570 }
571
572 WM_TASKBARCREATED_MESSAGE = RegisterWindowMessage(TEXT("TaskbarCreated"));
573
574// SendMessage(GetDesktopWindow(), 0x400, 0, 0); // ...hmm, not quite sure what this did anymore...?! ;)
575
576 // Show/hide the plugins based on the related xoblite.rc setting...
577 if (pSettings->pluginsHidden) SendMessage(hMainWnd, BB_BROADCAST, 0, (LPARAM)"@BBHidePlugins");
578 else SendMessage(hMainWnd, BB_BROADCAST, 0, (LPARAM)"@BBShowPlugins");
579
580 // Finally, as a "security precausion" we move the xoblite desktop window to the bottom...
581 SetWindowPos(pDesktop->hDesktopWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOSENDCHANGING);
582
583 // Execute the current style's rootCommand...
584 _beginthread(ExecuteRootCommand, 0, NULL);
585
587
588 if (pSettings->debugLogging) Log("xoblite", "All subsystems started successfully.");
589
590 //====================
591
592 // Check if the Blackbox font pack is installed, and if not display a warning message...
593 HFONT checkPackFont = CreateFont(12, 0, 0, 0, FW_NORMAL, false, false, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "mints-strong");
594 if (checkPackFont)
595 {
596 HDC temphdc = CreateCompatibleDC(NULL);
597 HGDIOBJ oldfont = SelectObject(temphdc, checkPackFont);
598 char createdFontName[33];
599 GetTextFace(temphdc, 32, createdFontName);
600 if (_stricmp(createdFontName, "mints-strong"))
601 {
602 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)"The Blackbox font pack does not seem to be installed. Get it from the xoblite website! -> http://xoblite.net/");
603 }
604
605 DeleteObject(checkPackFont);
606 DeleteObject(SelectObject(temphdc, oldfont));
607 DeleteDC(temphdc);
608 }
609
610 //====================
611/*
612 if (pSettings->debugLogging) // ### DEPRECATED (read: old boundary failsafe introduced by BlackboxZero, nowadays outgrown [>300 bytes] anyway...) ###
613 {
614 char msg[255];
615 sprintf(msg, "Debug: Size of StyleItem struct -> %d bytes.", sizeof(StyleItem));
616 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_INFORMATION_MESSAGE, (LPARAM)msg);
617 }
618*/
619 //====================
620
621 // Once everything else is up and running, we first wait another 3 seconds, then perform a check for updates...
622 SetTimer(GetBBWnd(), CHECK_FOR_UPDATES_DELAY_TIMER, 3000, (TIMERPROC)NULL);
623}
BImage * pBImage
Definition Blackbox.cpp:35
PluginManager * pPluginManager
Definition Blackbox.cpp:43
#define CONSOLE_PLAIN_MESSAGE
Definition BBApi.h:302
#define CONSOLE_SHELL_MESSAGE
Definition BBApi.h:301
Tooltips * pTooltips
Definition Blackbox.cpp:49
void SessionTimeStamp(bool beginSession)
Definition Blackbox.cpp:1757
PreviewItem * pPreviewItem
Definition Blackbox.cpp:45
PopupDialog * pPopupDialog
Definition Blackbox.cpp:44
@ SFX_STARTUP
Definition Sounds.h:38
void RegisterThemeFonts()
Definition Themes.cpp:229
Definition BImage.h:39
Definition Console.h:54
Definition Desktop.h:47
Definition Dock.h:70
Definition Hotkeys.h:51
Definition MenuCommon.h:43
Definition PluginManager.h:66
Definition PopupDialog.h:53
Definition PreviewItem.h:46
Definition Taskbar.h:67
Definition Toolbar.h:63
Definition Tooltips.h:44
Definition Workspaces.h:42

◆ exitBlackbox()

void exitBlackbox ( )
631{
632 // Just a security precausion... ;)
633 if (exitInProgress) return;
634 else exitInProgress = true;
635
636 // Set time stamp for end of session...
637 SessionTimeStamp(false);
638
639 ClearSticky();
640
641 DestroyRunBox(); // ...just in case the user left the run box open upon exit...
642
643 pSettings->accessLock = true;
644
645 if (pSettings->underExplorer) Shell_NotifyIcon(NIM_DELETE, &xobIconData);
646
647 if (pHotkeys) delete pHotkeys;
648 if (pPopupDialog) delete pPopupDialog;
649 if (pToolbar) delete pToolbar;
650 if (pPluginManager) delete pPluginManager;
651 if (pTaskbar) delete pTaskbar;
652 if (pTooltips) delete pTooltips;
653 if (pDock) delete pDock;
654 if (pPreviewItem) delete pPreviewItem;
655 if (pMenuCommon) delete pMenuCommon;
656 if (pWorkspaces) delete pWorkspaces;
657 if (pConsole) delete pConsole;
658 if (pDesktop) delete pDesktop;
659 if (pBImage) delete pBImage;
660
662
663 if (pSettings->underExplorer)
664 {
665 Shell_NotifyIcon(NIM_DELETE, &xobIconData);
666 DestroyIcon(xobIconData.hIcon);
667 }
668
669 if (pSettings->underExplorer && pSettings->explorerHidden) ShowExplorer();
670
671// if (pSettings->debugLogging) Log("xoblite", "exitBlackbox() completed successfully.");
672}
void ClearSticky()
Definition BBApi.cpp:3014
void DestroyRunBox()
Definition Broams.cpp:2804
void ShowExplorer()
Definition Broams.cpp:2632
void UnregisterThemeFonts()
Definition Themes.cpp:293

◆ restartBlackboxStop()

void restartBlackboxStop ( )
681{
682 // Disable dock transparency (for some reason this needs to be
683 // done to avoid visual artifacts) and hide the dock window...
684 if (pDock)
685 {
686 SetTransparency(pDock->hDockWnd, 255);
687 ShowWindow(pDock->hDockWnd, SW_HIDE);
688 }
689
690 // Unload all plugins...
691 if (pPluginManager) delete pPluginManager;
692
693 // Shall we pause the restart to let the user do something before continuing?
694 if ((GetAsyncKeyState(VK_SHIFT) & 0x8000) || pausedRestart)
695 {
696 MessageBox(GetBBWnd(), "Restart paused, press OK to continue... ", "xoblite", MB_OK | MB_ICONINFORMATION | MB_TOPMOST);
697 pausedRestart = false;
698 }
699}
bool SetTransparency(HWND hwnd, BYTE alpha)
Definition BBApi.cpp:3068

◆ restartBlackboxStart()

void restartBlackboxStart ( )
704{
705 int existingWorkspaces = pSettings->numberOfWorkspaces;
706
707 // Stop applicable subsystems...
708 if (pHotkeys) delete pHotkeys;
709 if (pPreviewItem) delete pPreviewItem;
710 if (pMenuCommon) delete pMenuCommon;
711
712 // Read configuration settings and style parameters...
713 pSettings->ReadConfiguration();
714 pSettings->ReadStyle();
715
716 // Set time locale if configured...
717 if (strlen(pSettings->timeDateLocale) > 0) setlocale(LC_TIME, pSettings->timeDateLocale);
718 else setlocale(LC_TIME, ""); // Not configured -> Reset the time locale to the user default obtained from the operating system...
719 pToolbar->GetClockText(true);
720/*
721 if (pSettings->debugLogging)
722 {
723 char msg[255];
724 sprintf(msg, "Time locale set to %s.", setlocale(LC_TIME, NULL));
725 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)msg);
726 }
727*/
728 //====================
729
730 if (existingWorkspaces != pSettings->numberOfWorkspaces)
731 {
732// if (pWorkspaces) delete pWorkspaces;
733// pWorkspaces = new Workspaces(hMainInstance);
734 pWorkspaces->GatherWindows();
735 if (pSettings->currentWorkspace > (pSettings->numberOfWorkspaces - 1))
736 {
737 pWorkspaces->SwitchToWorkspace(pSettings->numberOfWorkspaces - 1);
738 }
739 }
740
741 pWorkspaces->UpdateWorkspaceNames();
742
743 //====================
744
745 // Start applicable subsystems again...
746 pMenuCommon = new MenuCommon();
747 pMenuCommon->Initialize(hMainInstance);
751
752 // Update toolbar+dock+console size, position and alpha transparency...
753 pToolbar->UpdatePosition();
754 pDock->UpdateDockWindow();
755 pConsole->UpdatePosition();
756 pPopupDialog->UpdatePopupDialog();
757
758 // Show/hide the toolbar, console and plugins based on their applicable .rc settings...
759 ShowWindow(pToolbar->hToolbarWnd, pSettings->toolbarHidden ? SW_HIDE : SW_SHOWNOACTIVATE);
760 ShowWindow(pConsole->hConsoleWnd, pSettings->consoleHidden ? SW_HIDE : SW_SHOWNOACTIVATE);
761 if (pSettings->pluginsHidden) SendMessage(hMainWnd, BB_BROADCAST, 0, (LPARAM)"@BBHidePlugins");
762 else SendMessage(hMainWnd, BB_BROADCAST, 0, (LPARAM)"@BBShowPlugins");
763
764 // Force update of any external system tray plugins... (nb. as of xoblite bb5, the internal systray has been discontinued, but keeping this "just in case"... ;))
765 PostMessage(hMainWnd, BB_TRAYUPDATE, NULL, (LPARAM)TRAYICON_REFRESH);
766
767 // Ask the desktop to update...
768 pDesktop->GetClockText(true);
769 pDesktop->UpdateDesktopWindow();
770 // Finally, as a "security precausion" we move the xoblite desktop window to the bottom...
771 SetWindowPos(pDesktop->hDesktopWnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOSENDCHANGING);
772 // ...and move the console->dock->toolbar, if not hidden, to the top...
773 if (!pSettings->consoleHidden) SetForegroundWindow(pConsole->hConsoleWnd);
774 if (!pSettings->dockHidden) SetForegroundWindow(pDock->hDockWnd);
775 if (!pSettings->toolbarHidden) SetForegroundWindow(pToolbar->hToolbarWnd);
776
777 // Should we hide or show the Explorer taskbar etc? (i.e. if the related setting has changed)
778 if (pSettings->underExplorer && pSettings->explorerHidden) HideExplorer(true);
779 else ShowExplorer();
780
781 // Start Designer Mode (i.e. load the xDesignerGUI.dll privileged plugin) again if it was enabled before the core restart...
782 if (pSettings->designerModeEnabled)
783 {
784 char xDGUIpath[MAX_PATH];
785 sprintf(xDGUIpath, "%s\\%s", pSettings->SF_blackboxPath, "xDesignerGUI.dll");
786 if (!pPluginManager->IsPluginLoaded("xDesignerGUI.dll")) pPluginManager->LoadPlugin(xDGUIpath);
787 }
788
789 //====================
790
791 _beginthread(ExecuteRootCommand, 0, NULL);
792}
#define BB_TRAYUPDATE
Definition BBApi.h:188
#define TRAYICON_REFRESH
Definition BBApi.h:283

◆ ExecuteRootCommand()

void ExecuteRootCommand ( void * )
1520{
1521 if (!pSettings->disableRootCommands)
1522 {
1523 if (!(GetAsyncKeyState(VK_CONTROL) & 0x8000)) // -> Do not run the rootCommand if the control key is held down...
1524 {
1525 char temp[MAX_LINE_LENGTH] = "", param[32];
1526
1527 if (pSettings->wallpaperPerWorkspace && (pSettings->currentWorkspace > 0))
1528 {
1529 sprintf(param, "rootCommand%d:", (pSettings->currentWorkspace + 1));
1530 strcpy(temp, ReadString(stylePath(), param, ""));
1531 }
1532
1533 if (strlen(temp) == 0) strcpy(temp, ReadString(stylePath(), "rootCommand:", ""));
1534
1535 if (strlen(temp) > 0)
1536 {
1537 strcpy(pSettings->rootCommand, temp);
1538 pWallpaper->ExecuteRootCommand();
1539 }
1540 }
1541 }
1542 else SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, NULL, SPIF_SENDCHANGE); // Trigger desktop repaint under Windows Vista (...iirc?)
1543
1544 _endthread();
1545}
Wallpaper * pWallpaper
Definition Blackbox.cpp:50

◆ ShutdownWindows()

void ShutdownWindows ( int state,
bool skipAsking )
1553{
1554 if (!skipAsking)
1555 {
1557
1558 if (state == 0) SendMessage(GetBBWnd(), BB_POPUPMESSAGE, (WPARAM)"Are you sure you want to shut down your computer?", (LPARAM)"@xoblite System Shutdown");
1559 else if (state == 1) SendMessage(GetBBWnd(), BB_POPUPMESSAGE, (WPARAM)"Are you sure you want to reboot your computer?", (LPARAM)"@xoblite System Reboot");
1560 else if (state == 2) SendMessage(GetBBWnd(), BB_POPUPMESSAGE, (WPARAM)"Are you sure you want to log off?", (LPARAM)"@xoblite System LogOff");
1561 else if (state == 3) SendMessage(GetBBWnd(), BB_POPUPMESSAGE, (WPARAM)"Are you sure you want to hibernate?", (LPARAM)"@xoblite System Hibernate");
1562 else if (state == 4) SendMessage(GetBBWnd(), BB_POPUPMESSAGE, (WPARAM)"Are you sure you want to standby?", (LPARAM)"@xoblite System Standby");
1563 else return;
1564 }
1565 else
1566 {
1567 if (state < 3)
1568 {
1569 // To avoid a hanging Blackbox.exe due to e.g. slow unloading
1570 // plugins or certain hooks we perform the shell exit procedure
1571 // before initiating shutdown/reboot/logoff. Note that we can
1572 // always startBlackbox() again if the shutdown fails! (see below)
1573 exitBlackbox();
1574 }
1575 else
1576 {
1577 // Hibernate or standby -> Set time stamp for end of session...
1578 SessionTimeStamp(false);
1579 }
1580
1581 // Run the shutdown functions in their own thread...
1582 shutdownState = state;
1583 _beginthread(ShutdownThread, 0, NULL);
1584 }
1585}
#define BB_POPUPMESSAGE
Definition BBApi.h:166
void ShutdownThread(void *)
Definition Blackbox.cpp:1589
int shutdownState
Definition Blackbox.cpp:72

◆ ShutdownThread()

void ShutdownThread ( void * )
1590{
1591 // Log off?
1592 if (shutdownState == 2)
1593 {
1594 if (!ExitWindowsEx(EWX_LOGOFF, SHTDN_REASON_FLAG_PLANNED))
1595 {
1596 MBoxErrorValue("Log off failed");
1597 PostMessage(GetBBWnd(), BB_RESTART, 0, 0);
1598 }
1599 else
1600 {
1601 debugLogoff = true;
1602// PostMessage(hMainWnd, WM_CLOSE, 0, 0);
1603 PostQuitMessage(0);
1604 }
1605
1606 _endthread();
1607 }
1608
1609 //====================
1610
1611 HANDLE hToken = NULL;
1612 TOKEN_PRIVILEGES tkp;
1613
1614 OSVERSIONINFO osInfo;
1615 ZeroMemory(&osInfo, sizeof(osInfo));
1616 osInfo.dwOSVersionInfoSize = sizeof(osInfo);
1617 GetVersionEx(&osInfo);
1618
1619 // Under WinNT/2k/XP we need to adjust priviliges to be able to shutdown/reboot/hibernate/standby...
1620 if (osInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
1621 {
1622 // Get a token for this process...
1623 if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
1624 {
1625 MBoxErrorValue("OpenProcessToken failed");
1626 PostMessage(GetBBWnd(), BB_RESTART, 0, 0);
1627 _endthread();
1628 }
1629
1630 // Get the LUID for the shutdown privilege...
1631 LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &tkp.Privileges[0].Luid);
1632 tkp.PrivilegeCount = 1; // one privilege to set
1633 tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
1634
1635 // Get the shutdown privileges for this process...
1636 AdjustTokenPrivileges(hToken, false, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
1637 if (GetLastError() != ERROR_SUCCESS)
1638 {
1639 MBoxErrorValue("AdjustTokenPrivileges failed");
1640 PostMessage(GetBBWnd(), BB_RESTART, 0, 0);
1641 _endthread();
1642 }
1643 }
1644
1645 //====================
1646
1647 if (shutdownState == 0) // Shutdown?
1648 {
1649 if (!ExitWindowsEx(EWX_SHUTDOWN | EWX_POWEROFF, SHTDN_REASON_FLAG_PLANNED))
1650 {
1651 MBoxErrorValue("Shutdown failed!");
1652 PostMessage(GetBBWnd(), BB_RESTART, 0, 0);
1653 }
1654 else
1655 {
1656 debugShutdown = true;
1657// PostMessage(hMainWnd, WM_CLOSE, 0, 0);
1658 PostQuitMessage(0);
1659 }
1660 }
1661 else if (shutdownState == 1) // Reboot?
1662 {
1663 if (!ExitWindowsEx(EWX_REBOOT, SHTDN_REASON_FLAG_PLANNED))
1664 {
1665 MBoxErrorValue("Reboot failed!");
1666 // As the (un)installer may initiate a reboot we need to check
1667 // if the reboot was initiated by the (un)installer before
1668 // attempting to restart the shell... (see ShutdownWindows above)
1669 PostMessage(GetBBWnd(), BB_RESTART, 0, 0);
1670 }
1671 else
1672 {
1673 debugReboot = true;
1674// PostMessage(hMainWnd, WM_CLOSE, 0, 0);
1675 PostQuitMessage(0);
1676 }
1677 }
1678 else if (shutdownState == 3) // Hibernate? (a.k.a. "safe sleep" and "suspend to disk")
1679 {
1680 if (!SetSystemPowerState(FALSE, FALSE)) MBoxErrorValue("Hibernate failed!");
1681// ZeroMemory(&pSettings->Statistics, sizeof(pSettings->Statistics)); // Reset statistics...
1682 Sleep(3000); // Allow system clock some time to update after waking up... (note that we're running in a separate thread)
1683 SessionTimeStamp(true); // Begin new session...
1684 SetTimer(GetBBWnd(), CHECK_FOR_UPDATES_DELAY_TIMER, 3000, (TIMERPROC)NULL); // Wait 3 seconds, then perform a check for updates...
1685 }
1686 else if (shutdownState == 4) // Standby? (a.k.a. "sleep" and "suspend to RAM")
1687 {
1688 if (!SetSystemPowerState(TRUE, FALSE)) MBoxErrorValue("Standby failed!");
1689// ZeroMemory(&pSettings->Statistics, sizeof(pSettings->Statistics)); // Reset statistics...
1690 Sleep(3000); // Allow system clock some time to update after waking up... (note that we're running in a separate thread)
1691 SessionTimeStamp(true); // Begin new session...
1692 SetTimer(GetBBWnd(), CHECK_FOR_UPDATES_DELAY_TIMER, 3000, (TIMERPROC)NULL); // Wait 3 seconds, then perform a check for updates...
1693 }
1694
1695 // Disable shutdown privilege...
1696 tkp.Privileges[0].Attributes = 0;
1697 AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES) NULL, 0);
1698
1699 _endthread();
1700}
int MBoxErrorValue(LPCSTR szValue)
Definition BBApi.cpp:1627

◆ HideDesktopIcons()

void HideDesktopIcons ( bool hide)
1710{
1711 HWND window = FindWindow("Progman", "Program Manager");
1712 if (window != NULL)
1713 {
1714 window = FindWindowEx(window, NULL, "SHELLDLL_DefView", "");
1715 if (window != NULL)
1716 {
1717 window = FindWindowEx(window, NULL, "SysListView32", "FolderView");
1718 if (window != NULL)
1719 {
1720 if (hide)
1721 {
1722 if (IsWindowVisible(window))
1723 {
1724 ShowWindow(window, SW_HIDE);
1726 }
1727 }
1728 else if (desktopIconsPreviouslyHidden) ShowWindow(window, SW_SHOWNOACTIVATE);
1729 return;
1730 }
1731 }
1732 }
1733/*
1734 window = FindWindow("", "WorkerW");
1735 if (window != NULL)
1736 {
1737 window = FindWindowEx(window, NULL, "SHELLDLL_DefView", "");
1738 if (window != NULL)
1739 {
1740 window = FindWindowEx(window, NULL, "SysListView32", "FolderView");
1741 if (window != NULL)
1742 {
1743 if (hide) ShowWindow(window, SW_HIDE);
1744 else ShowWindow(window, SW_SHOWNOACTIVATE);
1745 return;
1746 }
1747 }
1748 }
1749*/
1750}
bool desktopIconsPreviouslyHidden
Definition Blackbox.cpp:1707

◆ SessionTimeStamp()

void SessionTimeStamp ( bool beginSession)
1758{
1759 time_t systemSessionTime;
1760 struct tm *localSessionTime;
1761 char timeStampString[MAX_LINE_LENGTH], msg[MAX_LINE_LENGTH];
1762
1763 time(&systemSessionTime);
1764 localSessionTime = localtime(&systemSessionTime);
1765
1766 //====================
1767
1768 _locale_t timestampLocale = _create_locale(LC_TIME, "en-US"); // -> Always use en-US format for the console timestamp...
1769 if (strstr(pSettings->toolbarClockFormat, "%p"))
1770 {
1771 // 12-hour clock including the current locale's AM/PM indicator
1772 _strftime_l(timeStampString, MAX_LINE_LENGTH, "%a %#d %b at %I:%M %p", localSessionTime, timestampLocale);
1773 }
1774 else
1775 {
1776 // 24-hour clock
1777 _strftime_l(timeStampString, MAX_LINE_LENGTH, "%a %#d %b at %H:%M", localSessionTime, timestampLocale);
1778 }
1779 _free_locale(timestampLocale);
1780
1781 //====================
1782
1783 if (beginSession)
1784 {
1785 sessionDuration = 0;
1786 SetTimer(GetBBWnd(), SESSION_DURATION_TIMER, 60000, (TIMERPROC)NULL);
1787 sprintf(msg, "Session begins %s.", timeStampString);
1788 }
1789 else
1790 {
1791 KillTimer(GetBBWnd(), SESSION_DURATION_TIMER);
1792 int durHours = sessionDuration / 60;
1793 int durMinutes = sessionDuration % 60;
1794// sprintf(msg, "Session ends %s (duration %d hour(s) %d minute(s)).", timeStampString, durHours, durMinutes);
1795 sprintf(msg, "Session ends %s (duration %d:%02d).", timeStampString, durHours, durMinutes);
1796 }
1797
1798 SendMessage(GetBBWnd(), BB_CONSOLEMESSAGE, (WPARAM)CONSOLE_REGULAR_MESSAGE, (LPARAM)msg);
1799 Log("TimeStamp", msg);
1800}

◆ CheckForUpdates()

void CheckForUpdates ( )
1805{
1806 if (pPluginManager && _stricmp(pSettings->checkedForUpdates, "*Disabled*")) _beginthread(periodicCheckForUpdates, 0, NULL);
1807}
void periodicCheckForUpdates(void *)
Definition PluginManager.cpp:864