Skip to content

Instantly share code, notes, and snippets.

@wmhilton
Last active Jun 6, 2018
Embed
What would you like to do?
Hotkey to Toggle Screen Resolution
#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