Jump to content

HRC - HotKey Resolution Changer [Updated 2012-May-16]


KaFu
 Share

Recommended Posts

Hello Community,

here's my latest idea...

HRC - HotKey Resolution Changer

Posted Image

Current Version: v2.1 (2012-May-16)

Do you also have a multi monitor setup and are annoyed with always having to change the resolution manually?

Then HCR will be as helpful to you as it is to me...

HRC - HotKey Resolution Changer

  • starts minimized (add shortcut to Startup to start with windows)
  • sits silently in the tray
  • define 2 to 9 shortcuts for different resolutions
  • switch resolution with just a keypress!
  • HotKeys can be set dynamically

Posted Image

HRC works fine at least on the XP SP3 and Win7 64bit SP1 machines I've tested it on. If you find bugs please let me know.

I share this program with NO WARRANTIES and NO LIABILITY FOR DAMAGES!

The executable and the source can be downloaded from my site: http://www.funk.eu

HRC utilizes HotKey.au3 and HotKeyInput.au3 by Yashied, Kudos for those functions m8!

Enjoy HRC, and let me know what you think of it...

Best Regards

Edited by KaFu
Link to comment
Share on other sites

  • Replies 73
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

320x200? This is not true for Windows. May be better to propose to select only working monitor resolutions, but not all.

I query the possible resolutions via WMI

; Generated by AutoIt Scriptomatic June 21, 2009

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output &= "Computer: " & $strComputer  & @CRLF
$Output &= "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_VideoSettings", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output &= "Element: " & $objItem.Element & @CRLF
      $Output &= "Setting: " & $objItem.Setting & @CRLF
      if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_VideoSettings" )
Endif

and 320x200 is returned as a valid resolution.... tested and it worked on my computer, though you can't see too much :D ... but I would be curious to know a better way to obtain valid resolutions.

Edited by KaFu
Link to comment
Share on other sites

I query the possible resolutions via WMI

; Generated by AutoIt Scriptomatic June 21, 2009

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output &= "Computer: " & $strComputer  & @CRLF
$Output &= "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_VideoSettings", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output &= "Element: " & $objItem.Element & @CRLF
      $Output &= "Setting: " & $objItem.Setting & @CRLF
      if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_VideoSettings" )
Endif
Link to comment
Share on other sites

Yes, all right, all resolutions which returns your code, supported by the monitor, but does not make sense to offer low resolution for users. Suddenly, he accidentally clicked on such a resolution (eg 320x200). After this long would have to sort the icons on desktop. Even Windows does not offer the resolution less than 800x600.

Yep, you're absolutly right. Next version will only contain resolutions >= 800x600 and Freq. <= 75 Hertz (don't want anyone to blow up his monitor). Thanks for the hint.

By the way, to obtain the all valid resolutions can be done as follows.

Thanks, did some research myself in the meantime and will implement this in the next version too, no WMI anymore.

; http://www.autoitscript.com/forum/index.php?showtopic=70679
; Mix from rasim and other replies

Global Const $EDS_RAWMODE = 0x2

Dim $DEVMODE, $DllRet

Global Const $ENUM_CURRENT_SETTINGS = -1
Global Const $ENUM_REGISTRY_SETTINGS = -2
Global $ENUM_ALL_SETTINGS = 0

$DEVMODE = DllStructCreate("char dmDeviceName[32];ushort dmSpecVersion;ushort dmDriverVersion;short dmSize;" & _
        "ushort dmDriverExtra;dword dmFields;short dmOrientation;short dmPaperSize;short dmPaperLength;" & _
        "short dmPaperWidth;short dmScale;short dmCopies;short dmDefaultSource;short dmPrintQuality;" & _
        "short dmColor;short dmDuplex;short dmYResolution;short dmTTOption;short dmCollate;" & _
        "byte dmFormName[32];dword dmBitsPerPel;int dmPelsWidth;dword dmPelsHeight;" & _
        "dword dmDisplayFlags;dword dmDisplayFrequency")

DllStructSetData($DEVMODE, "dmSize", DllStructGetSize($DEVMODE))

; =============================================

Do
    $DllRet = DllCall("user32.dll", "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_ALL_SETTINGS, _
            "ptr", DllStructGetPtr($DEVMODE), "dword", 0)
    $DllRet = $DllRet[0]

    $ENUM_ALL_SETTINGS += 1

    ConsoleWrite("Width = " & DllStructGetData($DEVMODE, "dmPelsWidth") & " " & _
            "Height = " & DllStructGetData($DEVMODE, "dmPelsHeight") & " " & _
            "Bits = " & DllStructGetData($DEVMODE, "dmBitsPerPel") & " " & _
            "Frequency = " & DllStructGetData($DEVMODE, "dmDisplayFrequency") & @LF)
Until $DllRet = 0

; =============================================
ConsoleWrite("Current from Display" & @CRLF)

$DllRet = DllCall("user32.dll", "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_CURRENT_SETTINGS, _
        "ptr", DllStructGetPtr($DEVMODE), "dword", 0)
$DllRet = $DllRet[0]


ConsoleWrite("Width = " & DllStructGetData($DEVMODE, "dmPelsWidth") & " " & _
        "Height = " & DllStructGetData($DEVMODE, "dmPelsHeight") & " " & _
        "Bits = " & DllStructGetData($DEVMODE, "dmBitsPerPel") & " " & _
        "Frequency = " & DllStructGetData($DEVMODE, "dmDisplayFrequency") & @LF)


; =============================================
ConsoleWrite("Current from Registry" & @CRLF)

$DllRet = DllCall("user32.dll", "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_REGISTRY_SETTINGS, _
        "ptr", DllStructGetPtr($DEVMODE), "dword", 0)
$DllRet = $DllRet[0]


ConsoleWrite("Width = " & DllStructGetData($DEVMODE, "dmPelsWidth") & " " & _
        "Height = " & DllStructGetData($DEVMODE, "dmPelsHeight") & " " & _
        "Bits = " & DllStructGetData($DEVMODE, "dmBitsPerPel") & " " & _
        "Frequency = " & DllStructGetData($DEVMODE, "dmDisplayFrequency") & @LF)


; =============================================
ConsoleWrite(@CRLF & "First try to obtain from Display, then from Registry" & @CRLF)

$DllRet = DllCall("user32.dll", "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_CURRENT_SETTINGS, _
        "ptr", DllStructGetPtr($DEVMODE), "dword", 0)
If $DllRet[0] = 0 Then
    ConsoleWrite(@CRLF & "From reg" & @CRLF)
    $DllRet = DllCall("user32.dll", "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_REGISTRY_SETTINGS, _
    "ptr", DllStructGetPtr($DEVMODE), "dword", 0)
EndIf

ConsoleWrite("Width = " & DllStructGetData($DEVMODE, "dmPelsWidth") & " " & _
        "Height = " & DllStructGetData($DEVMODE, "dmPelsHeight") & " " & _
        "Bits = " & DllStructGetData($DEVMODE, "dmBitsPerPel") & " " & _
        "Frequency = " & DllStructGetData($DEVMODE, "dmDisplayFrequency") & @LF)


; =============================================
$DEVMODE = 0
Link to comment
Share on other sites

Link to comment
Share on other sites

LCD monitors operate at 60Hz frequency.

Good to know that that's the standard, will restrict release to <= 60 Hertz... though my second 'monitor' supports 100 Hertz :D , connected my computer to my living-rooms TV-Set :D .
Link to comment
Share on other sites

Changelog v0.0.1.6 > v0.0.2.2

General

  • Fixed dynamic update of Combos
  • Fixed Redraw of large combo if no new value is selected
  • WMI is not used anymore, pure API calls
Source and Executable are available at

http://www.funk.eu

Best Regards

Link to comment
Share on other sites

It's great but it would be more awesome if it supported dual-screen modes.

Also, the link to your website points to SMF

Edit:Spelling

Edited by colafrysen
[font="Impact"]Use the helpfile, It´s one of the best exlusive features of Autoit.[/font]http://support.microsoft.com/kb/q555375ALIBI Run - a replacement for the windows run promptPC Controller - an application for controlling other PCs[size="1"]Science flies us to the moon. Religion flies us into buildings.[/size][size="1"]http://bit.ly/cAMPZV[/size]
Link to comment
Share on other sites

It's great but it would be more awesome if it supported dual-screen modes.

Yeah, good idea, will take a look at that... it's on the ToDo List :D .

Also, you link to you website points to SMF

Upsa, copy&paste :D , it's corrected.
Link to comment
Share on other sites

LCD monitors operate at 60Hz frequency.

Um, maybe some do, but not all. I can operate mine at up to 75Hz. I've heard of them going up to 120Hz. Depends on the pixel response time. (divide 1000/response-time-in-ms, and you get a rough estimate of the maximum refresh frequency)

Btw, Kafu - as usual, keep up the good work. Gotten some nice ideas from this thread and your program!

Link to comment
Share on other sites

  • 2 months later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...