Skip to content

Instantly share code, notes, and snippets.

@weitzhandler
Last active May 14, 2020 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weitzhandler/cd931a256913e4189fe979a43abdda66 to your computer and use it in GitHub Desktop.
Save weitzhandler/cd931a256913e4189fe979a43abdda66 to your computer and use it in GitHub Desktop.
Toggle ultrawide resolution
#include <windows.h>
typedef DWORD PELS_WIDTH;
const PELS_WIDTH Wide = 3440;
const PELS_WIDTH Narrow = 2560;
int __cdecl main()
{
DEVMODEA dm;
EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &dm);
PELS_WIDTH current = dm.dmPelsWidth;
dm.dmPelsWidth = current == Wide ? Narrow : Wide;
ChangeDisplaySettingsA(&dm, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment