A simple, small calculator placed discreetly near the Windows Taskbar or anywhere on the screen
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: HKCU\Run fallback for start-at-login when unpackaged (classic install)

StartupManager now falls back to the Run registry key when the MSIX StartupTask
API is unavailable, so the tray toggle works in the classic installer build and
stays consistent with the installer-set Run value.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Marco Maroni (Jul 14, 2026, 4:29 PM +0200) 9fa5fe4c 9a8b6a25

+36 -2
+36 -2
StartupManager.cpp
··· 11 11 12 12 namespace { 13 13 const wchar_t* kTaskId = L"TaskbarCalculatorStartup"; 14 + const wchar_t* kRunKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; 15 + const wchar_t* kRunVal = L"TaskbarCalculator"; 16 + 17 + // --- HKCU\...\Run fallback (used when the app has no package identity) --- 18 + bool RunKeyExists() { 19 + HKEY h; 20 + if (RegOpenKeyExW(HKEY_CURRENT_USER, kRunKey, 0, KEY_QUERY_VALUE, &h) != ERROR_SUCCESS) 21 + return false; 22 + LONG r = RegQueryValueExW(h, kRunVal, nullptr, nullptr, nullptr, nullptr); 23 + RegCloseKey(h); 24 + return r == ERROR_SUCCESS; 25 + } 26 + 27 + bool RunKeySet(bool on) { 28 + HKEY h; 29 + if (RegCreateKeyExW(HKEY_CURRENT_USER, kRunKey, 0, nullptr, 0, 30 + KEY_SET_VALUE, nullptr, &h, nullptr) != ERROR_SUCCESS) 31 + return false; 32 + LONG r; 33 + if (on) { 34 + wchar_t path[MAX_PATH]; 35 + GetModuleFileNameW(nullptr, path, MAX_PATH); 36 + wchar_t quoted[MAX_PATH + 2]; 37 + wsprintfW(quoted, L"\"%s\"", path); 38 + r = RegSetValueExW(h, kRunVal, 0, REG_SZ, (const BYTE*)quoted, 39 + (DWORD)((lstrlenW(quoted) + 1) * sizeof(wchar_t))); 40 + } else { 41 + r = RegDeleteValueW(h, kRunVal); 42 + if (r == ERROR_FILE_NOT_FOUND) r = ERROR_SUCCESS; 43 + } 44 + RegCloseKey(h); 45 + return r == ERROR_SUCCESS; 46 + } 14 47 } 15 48 16 49 namespace Startup { ··· 26 59 return State::Disabled; 27 60 } 28 61 } catch (...) { 29 - return State::Unavailable; // unpackaged / API missing 62 + // Unpackaged (classic install): use the HKCU\Run fallback. 63 + return RunKeyExists() ? State::Enabled : State::Disabled; 30 64 } 31 65 } 32 66 ··· 42 76 return true; 43 77 } 44 78 } catch (...) { 45 - return false; 79 + return RunKeySet(on); 46 80 } 47 81 } 48 82