Jump to content
Sign in to follow this  
Whitestar127

Show Screen Resolution dialog and refresh rate

Recommended Posts

Whitestar127

Hi

If I hit Alt+R and then type "control desk.cpl" then I get to the Display -> Screen Resolution in Windows 7.

Same if I type "RunDll32.exe shell32.dll,Control_RunDLL desk.cpl,3" for instance.

But what I'm really interested in is showing the refresh rate. Which means that from the Screen Resolution window I'll have to click Advanced Settings and then the Monitor tab.

I was just wondering; is there a fast way to get to the Monitor tab using AutoIt?

I know I can create a mouse click script or button press script from the Screen Resolution that gets me to the Monitor tab, but I was wondering if there is some function that can open that dialog immediately? Is there any way to do it?

Share this post


Link to post
Share on other sites
Centrally

Hi

If I hit Alt+R and then type "control desk.cpl" then I get to the Display -> Screen Resolution in Windows 7.

Same if I type "RunDll32.exe shell32.dll,Control_RunDLL desk.cpl,3" for instance.

But what I'm really interested in is showing the refresh rate. Which means that from the Screen Resolution window I'll have to click Advanced Settings and then the Monitor tab.

I was just wondering; is there a fast way to get to the Monitor tab using AutoIt?

I know I can create a mouse click script or button press script from the Screen Resolution that gets me to the Monitor tab, but I was wondering if there is some function that can open that dialog immediately? Is there any way to do it?

Hi Whitestar127,

What you need to use is external autoIt library called ChangeResolution.au3 which have such function included.

Here is ChangeResolution.au3 script: http://pastebin.com/9q3jxvkX

Share this post


Link to post
Share on other sites
Whitestar127

Hi, thanks for fast answer. :)

What I meant was that I just need a program/script that will show me the refresh rate without having to do all that clicking all the time.

The code you linked to seems to change the resolution, but I already have an app for that. I just need to see the refresh rate in a speedy matter. Either by getting to that Monitor tab fast, or maybe if there is an app out there that will display the refresh rate on screen.

Share this post


Link to post
Share on other sites
Centrally

Hi, thanks for fast answer. :)

What I meant was that I just need a program/script that will show me the refresh rate without having to do all that clicking all the time.

The code you linked to seems to change the resolution, but I already have an app for that. I just need to see the refresh rate in a speedy matter. Either by getting to that Monitor tab fast, or maybe if there is an app out there that will display the refresh rate on screen.

Than use @DesktopRefresh macro.

Edited by Centrally

Share this post


Link to post
Share on other sites
Whitestar127

Ah, great!

I'm trying to make a little app that will show the resolution + refresh rate. Here is my code:

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

$form1 = GUICreate("Screen Properties", 246, 31, 192, 124)

$size = GUICtrlCreateInput("size", 60, 4, 105, 21)

GUICtrlSetState(-1, $GUI_DISABLE)

$refresh = GUICtrlCreateInput("refresh", 196, 4, 45, 21)

GUICtrlSetState(-1, $GUI_DISABLE)

$bit = GUICtrlCreateInput("bit", 4, 4, 25, 21)

GUICtrlSetState(-1, $GUI_DISABLE)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

$refreshrate=@DesktopRefresh

$dtsize=@DesktopWidth & "x" & @DesktopHeight

$depth=@DesktopDepth

GUICtrlSetData($bit, $depth)

GUICtrlSetData($size, $dtsize)

GUICtrlSetData($refresh, $refreshrate)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Now here comes the difficult part...if I actually change the resolution, how do I make the app update/poll the values from the system and display them? I would have to do this within the loop I guess?

Is it possible the way the code is now? Or will I have to exit and run it to update the values in the boxes?

Will I have to change to OnEvent Mode perhaps?

Edited by Whitestar127

Share this post


Link to post
Share on other sites
JohnOne

lol, I just pressed alt + r, and it opened up this reply page.

Thought it rude not to oblige.

EDIT: on my machine, Win 7, It's windows key + r

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
Whitestar127

:)

Anyway, I figured it out by myself. Here is the finished code.

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

Opt("GUIOnEventMode", 1)

$form1 = GUICreate("Screen Properties", 246, 31, 192, 124)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

$size = GUICtrlCreateInput("size", 60, 4, 105, 21)

GUICtrlSetState(-1, $GUI_DISABLE)

$refresh = GUICtrlCreateInput("refresh", 196, 4, 45, 21)

GUICtrlSetState(-1, $GUI_DISABLE)

$bit = GUICtrlCreateInput("bit", 4, 4, 25, 21)

GUICtrlSetState(-1, $GUI_DISABLE)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

$refreshrate=@DesktopRefresh

$dtsize=@DesktopWidth & "x" & @DesktopHeight

$depth=@DesktopDepth

GUICtrlSetData($bit, $depth)

GUICtrlSetData($size, $dtsize)

GUICtrlSetData($refresh, $refreshrate)

While 1

Sleep(1000) ; Idle around

$refreshrate=@DesktopRefresh

$dtsize=@DesktopWidth & "x" & @DesktopHeight

$depth=@DesktopDepth

GUICtrlSetData($bit, $depth)

GUICtrlSetData($size, $dtsize)

GUICtrlSetData($refresh, $refreshrate)

WEnd

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×