-
Notifications
You must be signed in to change notification settings - Fork 10
Implemented #14 #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Implemented #14 #16
Conversation
primetime43
commented
Dec 30, 2025
- A checkbox labeled "Start with Windows" appears in the options dialog
- When checked, the app adds itself to the Windows Run registry key
- When unchecked, it removes itself from the registry
- The setting persists across app restarts by reading from the registry
- A checkbox labeled "Start with Windows" appears in the options dialog - When checked, the app adds itself to the Windows Run registry key - When unchecked, it removes itself from the registry - The setting persists across app restarts by reading from the registry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a "Start with Windows" feature that allows the application to automatically launch when Windows starts. The implementation adds a checkbox to the options dialog that, when toggled, modifies the Windows registry Run key to enable or disable automatic startup.
- Added registry interaction methods to manage Windows startup configuration
- Extended the settings infrastructure to include and persist the startup preference
- Integrated a checkbox control in the options dialog for user configuration
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Src/let-it-rain/SettingsManager.h | Added StartWithWindows field to Setting struct and declared static methods for registry operations |
| Src/let-it-rain/SettingsManager.cpp | Implemented registry read/write operations for managing Windows startup and integrated startup status into settings loading |
| Src/let-it-rain/Resource.h | Added IDC_CHECK_STARTUP control identifier for the startup checkbox |
| Src/let-it-rain/OptionDialog.h | Extended constructor and class to include StartWithWindows parameter and field |
| Src/let-it-rain/OptionDialog.cpp | Implemented checkbox initialization and click event handler that updates registry |
| Src/let-it-rain/DisplayWindow.cpp | Updated OptionsDialog instantiation to pass StartWithWindows setting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // Set the image and the text | ||
| SendMessage(hButton, BM_SETIMAGE, IMAGE_ICON, reinterpret_cast<LPARAM>(hIcon)); | ||
| SetWindowText(hButton, L"Github Repo"); |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling from 'Github' to 'GitHub'.
| SetWindowText(hButton, L"Github Repo"); | |
| SetWindowText(hButton, L"GitHub Repo"); |
| GetModuleFileName(nullptr, exePath, MAX_PATH); | ||
|
|
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return value of GetModuleFileName should be checked to ensure it succeeds. If the function fails (returns 0) or if the path is truncated (returns MAX_PATH and GetLastError returns ERROR_INSUFFICIENT_BUFFER), the exePath buffer may contain incomplete or invalid data, which would then be written to the registry.
| GetModuleFileName(nullptr, exePath, MAX_PATH); | |
| DWORD length = GetModuleFileName(nullptr, exePath, MAX_PATH); | |
| // If GetModuleFileName fails or the path is truncated, do not modify the registry | |
| if (length == 0 || | |
| (length == MAX_PATH && GetLastError() == ERROR_INSUFFICIENT_BUFFER)) | |
| { | |
| return; | |
| } |
| RegSetValueEx(hKey, appName, 0, REG_SZ, | ||
| reinterpret_cast<const BYTE*>(exePath), | ||
| static_cast<DWORD>((wcslen(exePath) + 1) * sizeof(wchar_t))); |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return value of RegSetValueEx should be checked to ensure the registry write operation succeeds. If the operation fails, the application will silently fail to enable startup functionality, leaving the user interface state inconsistent with the actual registry state.
| RegSetValueEx(hKey, appName, 0, REG_SZ, | |
| reinterpret_cast<const BYTE*>(exePath), | |
| static_cast<DWORD>((wcslen(exePath) + 1) * sizeof(wchar_t))); | |
| const LONG result = RegSetValueEx(hKey, appName, 0, REG_SZ, | |
| reinterpret_cast<const BYTE*>(exePath), | |
| static_cast<DWORD>((wcslen(exePath) + 1) * sizeof(wchar_t))); | |
| if (result != ERROR_SUCCESS) | |
| { | |
| std::wcerr << L"Failed to set startup registry value for " << appName | |
| << L" (error code: " << result << L")" << std::endl; | |
| } |
| { | ||
| if (RegOpenKeyEx(HKEY_CURRENT_USER, runKeyPath, 0, KEY_SET_VALUE, &hKey) == ERROR_SUCCESS) | ||
| { | ||
| RegDeleteValue(hKey, appName); |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return value of RegDeleteValue should be checked to ensure the registry delete operation succeeds. If the operation fails, the application will silently fail to disable startup functionality, leaving the user interface state inconsistent with the actual registry state.
| RegDeleteValue(hKey, appName); | |
| LONG deleteResult = RegDeleteValue(hKey, appName); | |
| if (deleteResult != ERROR_SUCCESS) | |
| { | |
| std::wcerr << L"Failed to delete startup registry value for " << appName | |
| << L". Error code: " << deleteResult << L'\n'; | |
| } |