Last active
August 16, 2024 19:25
-
-
Save billiegoose/b79ba3d153ca82b60f073f01060ed797 to your computer and use it in GitHub Desktop.
Hotkey to Toggle Screen Resolution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#b:: | |
Width := QueryScreenWidth() | |
if (Width = 3840) { | |
ChangeResolution(1920, 1080) | |
} else { | |
ChangeResolution(3840, 2160) | |
} | |
QueryScreenWidth() | |
{ | |
Return DllCall( "GetSystemMetrics", UInt,0 ) | |
} | |
ChangeResolution(Screen_Width := 1920, Screen_Height := 1080, Color_Depth := 32) | |
{ | |
VarSetCapacity(Device_Mode,156,0) | |
NumPut(156,Device_Mode,36) | |
DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&Device_Mode ) | |
NumPut(0x5c0000,Device_Mode,40) | |
NumPut(Color_Depth,Device_Mode,104) | |
NumPut(Screen_Width,Device_Mode,108) | |
NumPut(Screen_Height,Device_Mode,112) | |
Return DllCall( "ChangeDisplaySettingsA", UInt,&Device_Mode, UInt,0 ) | |
} | |
Return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment