AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

changing the desply's resolution

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
cstone



Joined: 16 Apr 2005
Posts: 28

PostPosted: Sat Nov 12, 2005 2:15 am    Post subject: changing the desply's resolution Reply with quote

i have found the register key that has the resolution information in it, and i am able to change it. the problem is that even if i do an EnvUpdate, it doesn't really change the resolution. the reg says it is what it to be (800x600), but it still is at what it use to be (1024x786).

does anyone know how to get the change to be updated so the resolution will change?
_________________
cstone
Back to top
View user's profile Send private message
1024x786
Guest





PostPosted: Sat Nov 12, 2005 6:17 am    Post subject: Reply with quote

Maybe you must close and launch Explorer,
Code:

Process, Close, Explorer.Exe
Process, Close, Explorer.Exe
Process, Close, Explorer.Exe
Sleep, 1000
Run, Explorer.Exe

Or, if don't work, close-it from Task Manager.
Bye!
Back to top
gs



Joined: 04 Jul 2005
Posts: 25

PostPosted: Sat Nov 12, 2005 6:53 am    Post subject: Reply with quote

Or call a command-line resolution changer?
_________________
Back to top
View user's profile Send private message Visit poster's website
mario_a



Joined: 12 Dec 2004
Posts: 51

PostPosted: Sat Nov 12, 2005 1:19 pm    Post subject: Reply with quote

gs wrote:
Or call a command-line resolution changer?


Absolutely. This is the simplest way.
I use MultiRes for this.

If you're interested, here's how my AHK code to call MultiRes from the command-line to change the resolution to 800 x 600 looks like.

Code:
NumpadDot & Numpad0::run, C:\Multires.exe /800`,600`,32`,85 /exit


Regards,
Mario
Back to top
View user's profile Send private message
jamestr



Joined: 05 Apr 2004
Posts: 96
Location: Connecticut USA

PostPosted: Thu Jan 05, 2006 4:46 pm    Post subject: Reply with quote

sweet multires!

Numpad0 & Numpad2::run, E:\Program Files\MultiRes\MultiRes.exe /800`,600`,32`,72 /exit
Numpad0 & Numpad1::run, E:\Program Files\MultiRes\MultiRes.exe /640`,480`,32`,72 /exit
Numpad0 & Numpad3::run, E:\Program Files\MultiRes\MultiRes.exe /1024`,768`,32`,72 /exit
Back to top
View user's profile Send private message
alan



Joined: 18 Jan 2006
Posts: 13

PostPosted: Wed Jan 18, 2006 5:58 pm    Post subject: without multires.exe Reply with quote

Just wanted to share how I do this on XP SP2 with an LCD monitor (no refresh rate issues). This changes the display to 1024x768. Perhaps this would help someone not wishing to install multires

Code:


ENUM_CURRENT_SETTINGS := -1
HEIGHT := 1024
WIDTH := 768

SysGet, MonitorName, MonitorName, %A_Index%
displayname := MonitorName
VarSetCapacity(display, 10000)
ret := DllCall("EnumDisplaySettings", "Str", displayname, "UInt", ENUM_CURRENT_SETTINGS, Str, display)
if ErrorLevel
   MsgBox Error level %ErrorLevel%

InsertInteger(HEIGHT, display, 108) ; InsertInteger() from the help files
InsertInteger(WIDTH, display, 112) ; InsertInteger() from the help files

ret := DllCall("ChangeDisplaySettings", "Str", display, "UInt", 0)
if ErrorLevel
   MsgBox Error level %ErrorLevel%
Back to top
View user's profile Send private message
mario_a



Joined: 12 Dec 2004
Posts: 51

PostPosted: Wed Jan 18, 2006 6:03 pm    Post subject: Reply with quote

Yes, but I don't think the refresh rate can be changed using EnumDisplaySettings.
Back to top
View user's profile Send private message
alan



Joined: 18 Jan 2006
Posts: 13

PostPosted: Wed Jan 18, 2006 6:44 pm    Post subject: Reply with quote

Quote:
Yes, but I don't think the refresh rate can be changed using EnumDisplaySettings.


I don't know, but there is a member within the DEVMODE struct seems to reference refresh/freq - dmDisplayFrequency so it may be possible.

I don't know the offset for it (though it shouldn't be hard to find) and don't use a CRT so I can't test it.

-Alan
Back to top
View user's profile Send private message
ender6



Joined: 16 Jan 2006
Posts: 7

PostPosted: Thu Jan 26, 2006 2:50 am    Post subject: Reply with quote

Alan,

That's a sweet script. It was just what I was looking for. Although, since this is way over my ability to understand how it works, how could I restore my resolution to the previous setting?

Basically, I'd like to run switch into 800x600 mode, run some program and then switch back to the original mode. Furthermore, if my screen is already 800 x 600, I'd like the script to exit the function.

I figure I've got to get something to read the current settings and save it to a var like OldHEIGHT, OLDWIDTH and just run the function again. But I guess I'm not understanding the DLLCall, all those parameters and the ret := and how to store/retrieve the right info.


Thanks in advance.
Back to top
View user's profile Send private message
ender6



Joined: 16 Jan 2006
Posts: 7

PostPosted: Thu Jan 26, 2006 4:34 am    Post subject: Reply with quote

Hmmm... here's another thing that I don't understand:

So I take Alan's code and wrap it in my function

SetScreen800x600(){ above code lines here
}


Then in my script hotkey script, I've got

+^!F11::
ifWinExist, MyApp
SetMonitor800x600()
WinActivate, MyApp
SetKeyDelay, 0, 10
Send, +^!F11
SetKeyDelay, 0, 0
Return

The monitor gets switched but then nothing else happens. It looks like after the SetMonitor function runs, the WinActivate gets lost during the monitor switch.
Back to top
View user's profile Send private message
toralf as guest
Guest





PostPosted: Thu Jan 26, 2006 6:51 am    Post subject: Reply with quote

Since you said that the switching of the Res is working, I think you are a bit off topic here. You should have posted it in your own topic (I just answered).

It may help to add a Sleep after the SetMonitor() and maybe to increase the values of setkeydelay to high values, e.g. 100. If that works, then you can start to decrease them.
Back to top
Laszlo



Joined: 14 Feb 2005
Posts: 4016
Location: Pittsburgh

PostPosted: Tue Feb 28, 2006 1:44 am    Post subject: Reply with quote

Here is another pure AHK solution, by manipulating the Windows Display Properties/Settings dialog.
Back to top
View user's profile Send private message
mario_a



Joined: 12 Dec 2004
Posts: 51

PostPosted: Tue Feb 28, 2006 6:24 am    Post subject: Reply with quote

This method does have the advantage of not needing a 3rd party utility, but in my experience command-line tools almost always work better, and are more reliable than sending keystrokes etc...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group