madflame991 Posted June 7, 2008 Posted June 7, 2008 PartyPooper hi all wokks but the code will not exitSame for me... please try to fix it Game Game Gadget! - read about indie games, gadgets, chiptunes and demoscenesAssembly-like language interpreter and custom machine emulatorSuper Mario Screen Mate - official website or autoit forum pageCogut - Puzzle Game + Editor like sokoban and others
PartyPooper Posted June 10, 2008 Author Posted June 10, 2008 Same for me... please try to fix itLittle more info please like what OS are you using, is it the compiled version that doesn't work or the code itself, which version of AutoIt etc.
james3mg Posted December 17, 2008 Posted December 17, 2008 (edited) Sorry to resurrect an old post again, but... Works well on Vista sp1 as well! Nice job. My only issue is with multiple monitors, it only affects my primary monitor. I looked at the EnumDisplaySettings on msdn and tried to switch the device call so it might also work with my secondary monitor, but no dice. Any ideas how one would go about modifying this to support an additional display device? Thanks Edited December 17, 2008 by james3mg "There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
PartyPooper Posted December 18, 2008 Author Posted December 18, 2008 Not off the top of my head but I know there are several topics on multiple monitors on here that may be useful. Unfortunately, I don't run multiple monitors at the moment.
DangerousDan Posted January 18, 2009 Posted January 18, 2009 Same for me... please try to fix it in response to the script not exiting/remaining in system tray. comment out lines 62 and 63 ;~ DllCall($dll, "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _ ;~ "int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width) that's what was making the function hang for me on Vista SP1. on another note: for some reason Vista constantly resets my screen res to 1024x768 after it resumes from suspend mode... I wrote a script to keep in the quick launch bar until I can figure it out lol.
PsaltyDS Posted January 27, 2009 Posted January 27, 2009 A modification using ChangeDisplaySettingsEx, so that specific display instances can be targeted:From bobchernow in Multiple monitor change resolution:OK, Here goes. This is my first UDF so be gentle.expandcollapse popup#include-once ;=============================================================================== ; Function Name: _ChangeScreenResEx() ; Description: Changes the current screen geometry, colour and refresh rate. ; Version: 1.0.0.0 ; Parameter(s): $i_DisplayNum - Display to change, starting at 1 ; $i_Width - Width of the desktop screen in pixels. (horizontal resolution) ; $i_Height - Height of the desktop screen in pixels. (vertical resolution) ; $i_BitsPP - Depth of the desktop screen in bits per pixel. ; $i_RefreshRate - Refresh rate of the desktop screen in hertz. ; Requirement(s): AutoIt Beta > 3.1 ; Return Value(s): On Success - Screen is adjusted, @ERROR = 0 ; On Failure - sets @ERROR = 1 ; Forum(s): ; Author(s): Original code - psandu.ro, PartyPooper ; Modifications - bobchernow ;=============================================================================== Func _ChangeScreenResEx($i_DisplayNum = 1, $i_Width = @DesktopWidth, $i_Height = @DesktopHeight, $i_BitsPP = @DesktopDepth, $i_RefreshRate = @DesktopRefresh) Local Const $DM_PELSWIDTH = 0x00080000 Local Const $DM_PELSHEIGHT = 0x00100000 Local Const $DM_BITSPERPEL = 0x00040000 Local Const $DM_DISPLAYFREQUENCY = 0x00400000 Local Const $CDS_TEST = 0x00000002 Local Const $CDS_UPDATEREGISTRY = 0x00000001 Local Const $DISP_CHANGE_RESTART = 1 Local Const $DISP_CHANGE_SUCCESSFUL = 0 Local Const $HWND_BROADCAST = 0xffff Local Const $WM_DISPLAYCHANGE = 0x007E If $i_Width = "" Or $i_Width = -1 Then $i_Width = @DesktopWidth; default to current setting If $i_Height = "" Or $i_Height = -1 Then $i_Height = @DesktopHeight; default to current setting If $i_BitsPP = "" Or $i_BitsPP = -1 Then $i_BitsPP = @DesktopDepth; default to current setting If $i_RefreshRate = "" Or $i_RefreshRate = -1 Then $i_RefreshRate = @DesktopRefresh; default to current setting Local $DEVMODE = DllStructCreate("byte[32];int[10];byte[32];int[6]") Local $s_Display $s_Display = "\\.\Display" & $i_DisplayNum Local $B = DllCall("user32.dll", "int", "EnumDisplaySettings", "ptr", 0, "int", 0, "ptr", DllStructGetPtr($DEVMODE)) If @error Then $B = 0 SetError(1) Return $B Else $B = $B[0] EndIf If $B <> 0 Then DllStructSetData($DEVMODE, 2, BitOR($DM_PELSWIDTH, $DM_PELSHEIGHT, $DM_BITSPERPEL, $DM_DISPLAYFREQUENCY), 5) DllStructSetData($DEVMODE, 4, $i_Width, 2) DllStructSetData($DEVMODE, 4, $i_Height, 3) DllStructSetData($DEVMODE, 4, $i_BitsPP, 1) DllStructSetData($DEVMODE, 4, $i_RefreshRate, 5) $B = DllCall("user32.dll", "int", "ChangeDisplaySettingsEx","str", $s_Display, "ptr", DllStructGetPtr($DEVMODE), "hwnd", 0, "dword", $CDS_TEST, "lparam", 0) If @error Then $B = -1 Else $B = $B[0] EndIf Select Case $B = $DISP_CHANGE_RESTART $DEVMODE = "" Return 2 Case $B = $DISP_CHANGE_SUCCESSFUL DllCall("user32.dll", "int", "ChangeDisplaySettingsEx","str", $s_Display, "ptr", DllStructGetPtr($DEVMODE), "hwnd", 0, "dword", $CDS_UPDATEREGISTRY, "lparam", 0) DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND_BROADCAST, "int", $WM_DISPLAYCHANGE, _ "int", $i_BitsPP, "int", $i_Height * 2 ^ 16 + $i_Width) $DEVMODE = "" Return 1 Case Else $DEVMODE = "" SetError(1) Return $B EndSelect EndIf EndFunc;==>_ChangeScreenResExAnd here is what I have been using to test it.#include <ChangeResolutionEx.au3> _ChangeScreenResEx(1,1024,600,-1,-1) _ChangeScreenResEx(2,1680,1050,-1,-1)I am still struggling with the DetachMonitorEx.Au3 UDF but I hope to get that working soon. It seems to involve mucking with the $DEVMODE flags and then calling the ChangeDisplaySettingsEx twice, but it is not working as of now.Bob Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
WorknMan Posted January 29, 2009 Posted January 29, 2009 (edited) Hey guys, I can use this au3 file to change to any resolution I've tried except for 1152x864. If I try it, I get the error that says can't change resolution - check parameters. I can switch to this resolution via the Display properties (Winxp SP3), so not sure why it doesn't work in the script? Is there something hard-coded in the au3 file to only allow certain resolutions? EDIT: n/m, works on another PC, so it's obviously something specific with the monitor. Edited January 29, 2009 by WorknMan
bobchernow Posted February 7, 2009 Posted February 7, 2009 Hey guys,I can use this au3 file to change to any resolution I've tried except for 1152x864. If I try it, I get the error that says can't change resolution - check parameters.I can switch to this resolution via the Display properties (Winxp SP3), so not sure why it doesn't work in the script? Is there something hard-coded in the au3 file to only allow certain resolutions?EDIT: n/m, works on another PC, so it's obviously something specific with the monitor.Are you working on a single monitor or on multiple monitor system? --------------------bobchernow, Bob ChernowWhat a long strange trip it's beenUDFs: [post="635594"]Multiple Monitor Screen Resolution Change[/post]
maison09 Posted April 18, 2009 Posted April 18, 2009 (edited) Thanks a lot for your sharing maison de credit Edited April 18, 2009 by maison09
catcat Posted April 24, 2009 Posted April 24, 2009 I am a new commer, I want to have more informationsimulation assurance vie
jaenster Posted June 27, 2009 Posted June 27, 2009 here it dont work, Dont care witch res i set. (Win XP PRO SP3) -jaenster
AlienStar Posted August 11, 2009 Posted August 11, 2009 (edited) hello everybody how can add a condition for this script ???? I mean : if ( width <= 800 ^ Height <= 600 ) change to 1024x768 and even if one of them ( width or height ) was <= last value also change to 1024x768 I mean I wanna the width > 800 and the height > 600 but if the resolution was bigger than 800x600 for example (1152x864) don't do any thing thanks so much Edited August 11, 2009 by AlienStar
PartyPooper Posted August 12, 2009 Author Posted August 12, 2009 Have a read about @DesktopHeight and @DesktopWidth in the help file.
TheGeneral Posted August 13, 2009 Posted August 13, 2009 How can i change a monitor to primary, through dll call? There's any possibility to change the default sound output through the same method?
pitchalov Posted November 26, 2010 Posted November 26, 2010 Inspired by original thread. All credit should go to psandu.ro, I just converted his code into a UDF and modified it slightly.Hi,I am new to this forum and AutoIt in general. I discovered this old post and this could be interesting for me, but i can't manage to find the "ChangeResolution.au3" file to test it (it is not in the AutoIt standard library, isn't it?).Could someone tell me how to download it?PS. I am using the version v3.3.6.1 of AutoItThanks in Advance for the answers.
E1M1 Posted November 26, 2010 Posted November 26, 2010 PsaltyDS posted it, just copy code and save it as au3 file. edited
Esquared Posted December 6, 2010 Posted December 6, 2010 PsaltyDS posted it, just copy code and save it as au3 file.I'm really new to Scripting and AutoIt and am having a lot of trouble with this. All I want to do is change a users screen resolution. I copied PsaltyDS's code and saved it as "ChangeResolution.au3" in the include folder in AutoIt. I've tried running the following code:#include <ChangeResolution.au3>$iWidth = 1024$iHeight = 768$iBitsPP = 32$iRefreshRate = 60$vRes = _ChangeScreenRes($iWidth, $iHeight, $iBitsPP, $iRefreshRate)If @error Then MsgBox(262160, "ERROR", "Unable to change screen - check parameters")EndIfAnd all I get is the following error:>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\<username>\Desktop\AutoIt3\Scripts\resolution test.au3" C:\Users\<username>\Desktop\AutoIt3\Scripts\resolution test.au3 (8) : ==> Unknown function name.:$vRes = _ChangeScreenRes($iWidth, $iHeight, $iBitsPP, $iRefreshRate)$vRes = ^ ERROR>Exit code: 1 Time: 0.244I've been through tons of posts and I'm pretty frustrated, I didn't thing changing the screen resolution would be so complicated...Any help would be appreciated!!!Thanks
PartyPooper Posted December 9, 2010 Author Posted December 9, 2010 Check that the SciTE config User Include Dir is pointing to the folder where you stored ChangeResolution.au3
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now