Compare commits

..

4 Commits

Author SHA1 Message Date
cedb800012 Fix annotations for WinMain
Fix "C28251 Inconsistent annotation for function" compiler warning by correctly defining WinMain.
2025-08-15 11:44:51 -07:00
5911ca0100 Update README.md
Update the readme to reflect the current state of the project. The program is much more complete now, and has been tested and works flawlessly on both Windows Vista and 7.
2025-08-14 23:20:15 -07:00
e4157e70b3 Fix 32-bit profiles 2025-08-12 12:40:59 -04:00
a5555b4ee1 Guarantee Vista support
Define NT version headers so that Windows Vista support should reasonably be guaranteed, since we will not be using any newer APIs.
2025-08-12 09:16:34 -04:00
3 changed files with 15 additions and 7 deletions

View File

@ -2,9 +2,9 @@
A utility for switching the resolution of your laptop's display based on the current power state. A utility for switching the resolution of your laptop's display based on the current power state.
Currently a work in progress. Not very useful yet since it doesn't save your preferences. It doesn't even have an icon. Currently a work in progress. It works reasonably well for a standard single display configuration, but other scenarios have not been extensively tested, and there are some edge cases that may need to be worked out.
This is a simple C program written using Visual Studio 2022 that has no external dependencies. It should support Windows Vista or higher, but this hasn't been tested yet. This is a simple C program written using Visual Studio 2022 that has no external dependencies. It supports Windows Vista or higher.
## TODO ## TODO
- [x] Save preferences to the Windows registry. - [x] Save preferences to the Windows registry.

View File

@ -1,3 +1,7 @@
#define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT _WIN32_WINNT_VISTA
#define NTDDI_VERSION NTDDI_VISTA
#include <stdio.h> #include <stdio.h>
#include <windows.h> #include <windows.h>
#include <shellapi.h> #include <shellapi.h>
@ -333,7 +337,7 @@ static LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l
return DefWindowProc(hWnd, uMsg, wParam, lParam); return DefWindowProc(hWnd, uMsg, wParam, lParam);
} }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd) {
if (!LoadPrefs()) { // set both battery and AC to current display mode if there are no preferences set if (!LoadPrefs()) { // set both battery and AC to current display mode if there are no preferences set
DISPLAY_MODE currentMode = GetCurrentDisplayMode(); DISPLAY_MODE currentMode = GetCurrentDisplayMode();
userPrefs.modeAC = currentMode; userPrefs.modeAC = currentMode;

View File

@ -82,9 +82,10 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ComCtl32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>ComCtl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<MinimumRequiredVersion>6.0</MinimumRequiredVersion>
</Link> </Link>
<Manifest> <Manifest>
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness> <EnableDpiAwareness>true</EnableDpiAwareness>
</Manifest> </Manifest>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -100,9 +101,10 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ComCtl32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>ComCtl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<MinimumRequiredVersion>6.0</MinimumRequiredVersion>
</Link> </Link>
<Manifest> <Manifest>
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness> <EnableDpiAwareness>true</EnableDpiAwareness>
</Manifest> </Manifest>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -116,9 +118,10 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ComCtl32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>ComCtl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<MinimumRequiredVersion>6.0</MinimumRequiredVersion>
</Link> </Link>
<Manifest> <Manifest>
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness> <EnableDpiAwareness>true</EnableDpiAwareness>
</Manifest> </Manifest>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -134,9 +137,10 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ComCtl32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>ComCtl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<MinimumRequiredVersion>6.0</MinimumRequiredVersion>
</Link> </Link>
<Manifest> <Manifest>
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness> <EnableDpiAwareness>true</EnableDpiAwareness>
</Manifest> </Manifest>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>