[RESOLVED] Change resolution in 1 click

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Trymado
Posts: 24
Joined: 04 Oct 2019, 02:30

[RESOLVED] Change resolution in 1 click

13 Oct 2019, 10:02

Hello everyone,
as I want in the title I want a script that allows clicking on 1920x1080 work on win7 and win10
Most of the script I saw offers to do but pressing a key, me what I would like it is that when the click on it passes in 1920x1080 and possibly the frequency (for the day I pass on a screen 4k)
Thanks in advance
Last edited by Trymado on 14 Oct 2019, 00:51, edited 1 time in total.
User avatar
boiler
Posts: 17215
Joined: 21 Dec 2014, 02:44

Re: Change resolution in 1 click

13 Oct 2019, 10:38

Untested because I don't want to change the resolution on my screen, but you can try this, which comes from here. Press F1 to change resolution (you can change it to any key you want). Note that you also have to pass color depth and frequency, so I would make sure they are 32 and 60 respectively for your 1920x1280 mode before you run this.

Code: Select all

F1::ChangeDisplaySettings(32, 1920, 1280, 60)

ChangeDisplaySettings( cD, sW, sH, rR ) {
  VarSetCapacity(dM,156,0), NumPut(156,dM,36)
  DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&dM ), NumPut(0x5c0000,dM,40)
  NumPut(cD,dM,104),  NumPut(sW,dM,108),  NumPut(sH,dM,112),  NumPut(rR,dM,120)
  Return DllCall( "ChangeDisplaySettingsA", UInt,&dM, UInt,0 )
}
User avatar
boiler
Posts: 17215
Joined: 21 Dec 2014, 02:44

Re: Change resolution in 1 click

13 Oct 2019, 10:43

If that doesn't work, try this version from this thread:

Code: Select all

F1::ChangeResolution(1920, 1080)

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 )
}
Trymado
Posts: 24
Joined: 04 Oct 2019, 02:30

Re: Change resolution in 1 click

13 Oct 2019, 15:14

Many Thanks

It is possible to have a version that when you click on the script ahk it changes the resolution?
User avatar
boiler
Posts: 17215
Joined: 21 Dec 2014, 02:44

Re: Change resolution in 1 click

13 Oct 2019, 15:24

What do you mean by click on the script? Click on the script's icon in the system tray?
User avatar
boiler
Posts: 17215
Joined: 21 Dec 2014, 02:44

Re: Change resolution in 1 click

13 Oct 2019, 15:31

If you mean as soon as you run the script, just remove the F1:: from the first line.
Trymado
Posts: 24
Joined: 04 Oct 2019, 02:30

Re: Change resolution in 1 click

13 Oct 2019, 17:45

Work perfectly on my Win7!
Thanks a lot
Last question, I do not have Win10, but for my friends who have Win10, does it work too?
User avatar
boiler
Posts: 17215
Joined: 21 Dec 2014, 02:44

Re: Change resolution in 1 click

13 Oct 2019, 17:57

According to the thread it came from, the function called ChangeResolution() works on Win10.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 194 guests