langtudongnai45 Posted September 10, 2014 Share Posted September 10, 2014 (edited) Hi all, I have a question: How to change color depth of desktop from 16bit to 32bit and the same? I used ChangeScreenRes.au3 UDF but not working on 1920x1080 resolution Please help me. Thanks and best regards Edited September 10, 2014 by langtudongnai45 Link to comment Share on other sites More sharing options...
guinness Posted September 10, 2014 Share Posted September 10, 2014 UDF link? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
langtudongnai45 Posted September 10, 2014 Author Share Posted September 10, 2014 UDF link? Here: https://github.com/dolfinus/Win7PE-by-M-ximus_FullRAM_Rus/blob/master/Programs/AutoIt3.wim/Include/ChangeScreenRes.au3 Link to comment Share on other sites More sharing options...
guinness Posted September 10, 2014 Share Posted September 10, 2014 Try again, 404 error. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
langtudongnai45 Posted September 10, 2014 Author Share Posted September 10, 2014 Here ChangeScreenRes.au3 Link to comment Share on other sites More sharing options...
guinness Posted September 10, 2014 Share Posted September 10, 2014 There is a link in the code >> http://www.autoitscript.com/forum/index.php?showtopic=20121. The author explicitly states use a different UDF, hence maybe search the Forum for a better UDF. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
johnmcloud Posted September 10, 2014 Share Posted September 10, 2014 (edited) Try this ( N.B. i have stripped some part like the orientation/GUI and added the Const into the Func ) expandcollapse popup; psandu.ro - PartyPooper - KaFu _ChangeScreenRes(@DesktopWidth, @DesktopHeight, 16, @DesktopRefresh) Sleep(2000) _ChangeScreenRes(@DesktopWidth, @DesktopHeight, 32, @DesktopRefresh) Func _ChangeScreenRes($i_Width = @DesktopWidth, $i_Height = @DesktopHeight, $i_BitsPP = @DesktopDepth, $i_RefreshRate = @DesktopRefresh) Local $h_DLL_user32 = DllOpen("user32.dll") Local Const $ENUM_CURRENT_SETTINGS = -1 Local Const $ENUM_REGISTRY_SETTINGS = -2 Local Const $_tag_POINTL = "long x;long y" Local Const $_tag_DEVMODE = "char dmDeviceName[32];ushort dmSpecVersion;ushort dmDriverVersion;short dmSize;" & _ "ushort dmDriverExtra;dword dmFields;" & $_tag_POINTL & ";dword dmDisplayOrientation;dword dmDisplayFixedOutput;" & _ "short dmColor;short dmDuplex;short dmYResolution;short dmTTOption;short dmCollate;" & _ "byte dmFormName[32];ushort LogPixels;dword dmBitsPerPel;int dmPelsWidth;dword dmPelsHeight;" & _ "dword dmDisplayFlags;dword dmDisplayFrequency" Local Const $DM_ORIENTATION = 0x00000001 Local Const $DM_PAPERSIZE = 0x00000002 Local Const $DM_PAPERLENGTH = 0x00000004 Local Const $DM_PAPERWIDTH = 0x00000008 Local Const $DM_SCALE = 0x00000010 Local Const $DM_COPIES = 0x00000100 Local Const $DM_DEFAULTSOURCE = 0x00000200 Local Const $DM_PRINTQUALITY = 0x00000400 Local Const $DM_POSITION = 0x00000020 Local Const $DM_DISPLAYORIENTATION = 0x00000080 Local Const $DM_DISPLAYFIXEDOUTPUT = 0x20000000 Local Const $DM_COLOR = 0x00000800 Local Const $DM_DUPLEX = 0x00001000 Local Const $DM_YRESOLUTION = 0x00002000 Local Const $DM_TTOPTION = 0x00004000 Local Const $DM_COLLATE = 0x00008000 Local Const $DM_FORMNAME = 0x00010000 Local Const $DM_LOGPIXELS = 0x00020000 Local Const $DM_BITSPERPEL = 0x00040000 Local Const $DM_PELSWIDTH = 0x00080000 Local Const $DM_PELSHEIGHT = 0x00100000 Local Const $DM_DISPLAYFLAGS = 0x00200000 Local Const $DM_NUP = 0x00000040 Local Const $DM_DISPLAYFREQUENCY = 0x00400000 Local Const $DM_ICMMETHOD = 0x00800000 Local Const $DM_ICMINTENT = 0x01000000 Local Const $DM_MEDIATYPE = 0x02000000 Local Const $DM_DITHERTYPE = 0x04000000 Local Const $DM_PANNINGWIDTH = 0x08000000 Local Const $DM_PANNINGHEIGHT = 0x10000000 Local Const $DM_DISPLAYQUERYORIENTATION = 0x01000000 Local Const $CDS_TEST = 0x00000002 Local Const $CDS_UPDATEREGISTRY = 0x00000001 Local Const $CDS_RESET = 0x40000000 Local Const $CDS_SET_PRIMARY = 0x00000010 Local Const $CDS_VIDEOPARAMETERS = 0x00000020 Local Const $CDS_ENABLE_UNSAFE_MODES = 0x00000100 Local Const $CDS_DISABLE_UNSAFE_MODES = 0x00000200 ; error 2 = EnumDisplaySettingsEx for $ENUM_CURRENT_SETTINGS failed Local Const $DISP_CHANGE_SUCCESSFUL = 0 Local Const $DISP_CHANGE_FAILED = -1 Local Const $DISP_CHANGE_BADMODE = -2 Local Const $DISP_CHANGE_NOTUPDATED = -3 Local Const $DISP_CHANGE_BADFLAGS = -4 Local Const $DISP_CHANGE_BADPARAM = -5 Local Const $DISP_CHANGE_BADDUALVIEW = -6 Local Const $DISP_CHANGE_RESTART = 1 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($_tag_DEVMODE) DllStructSetData($DEVMODE, "dmSize", DllStructGetSize($DEVMODE)) ; Using the dmFields flag of DM_DISPLAYORIENTATION, ChangeDisplaySettingsEx can be used to dynamically rotate the screen orientation. However, the DM_PELSWIDTH and DM_PELSHEIGHT flags cannot be used to change the screen resolution. Local $i_DllRet = DllCall($h_DLL_user32, "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_CURRENT_SETTINGS, "ptr", DllStructGetPtr($DEVMODE), "dword", 0) If $i_DllRet[0] = 0 Then $i_DllRet = DllCall($h_DLL_user32, "int", "EnumDisplaySettingsEx", "ptr", 0, "dword", $ENUM_REGISTRY_SETTINGS, "ptr", DllStructGetPtr($DEVMODE), "dword", 0) EndIf #cs ConsoleWrite("dmDeviceName " & DllStructGetData($DEVMODE, "dmDeviceName") & @CRLF) ConsoleWrite("dmSpecVersion " & DllStructGetData($DEVMODE, "dmSpecVersion") & @CRLF) ConsoleWrite("dmDriverVersion " & DllStructGetData($DEVMODE, "dmDriverVersion") & @CRLF) ConsoleWrite("dmSize " & DllStructGetData($DEVMODE, "dmSize") & @CRLF) ConsoleWrite("dmDriverExtra " & DllStructGetData($DEVMODE, "dmDriverExtra") & @CRLF) ConsoleWrite("dmFields " & DllStructGetData($DEVMODE, "dmFields") & @CRLF) ConsoleWrite("dmPositionx " & DllStructGetData($DEVMODE, "dmPositionx") & @CRLF) ConsoleWrite("dmPositiony " & DllStructGetData($DEVMODE, "dmPositiony") & @CRLF) ConsoleWrite("- dmDisplayOrientation " & DllStructGetData($DEVMODE, "dmDisplayOrientation") & @CRLF) ConsoleWrite("dmDisplayFixedOutput " & DllStructGetData($DEVMODE, "dmDisplayFixedOutput") & @CRLF) ConsoleWrite("dmColor " & DllStructGetData($DEVMODE, "dmColor") & @CRLF) ConsoleWrite("dmDuplex " & DllStructGetData($DEVMODE, "dmDuplex") & @CRLF) ConsoleWrite("dmYResolution " & DllStructGetData($DEVMODE, "dmYResolution") & @CRLF) ConsoleWrite("dmTTOption " & DllStructGetData($DEVMODE, "dmTTOption") & @CRLF) ConsoleWrite("dmCollate " & DllStructGetData($DEVMODE, "dmCollate") & @CRLF) ConsoleWrite("dmFormName " & DllStructGetData($DEVMODE, "dmFormName") & @CRLF) ConsoleWrite("dmLogPixels " & DllStructGetData($DEVMODE, "dmLogPixels") & @CRLF) ConsoleWrite("dmBitsPerPel " & DllStructGetData($DEVMODE, "dmBitsPerPel") & @CRLF) ConsoleWrite("dmPelsWidth " & DllStructGetData($DEVMODE, "dmPelsWidth") & @CRLF) ConsoleWrite("dmPelsHeight " & DllStructGetData($DEVMODE, "dmPelsHeight") & @CRLF) ConsoleWrite("dmDisplayFlags " & DllStructGetData($DEVMODE, "dmDisplayFlags") & @CRLF) ConsoleWrite("dmDisplayFrequency " & DllStructGetData($DEVMODE, "dmDisplayFrequency") & @CRLF & @CRLF) #ce If @error Then $DEVMODE = 0 SetError(1) Return 1 Else $i_DllRet = $i_DllRet[0] EndIf If $i_DllRet <> 0 Then DllStructSetData($DEVMODE, "dmPelsWidth", $i_Width) DllStructSetData($DEVMODE, "dmPelsHeight", $i_Height) DllStructSetData($DEVMODE, "dmBitsPerPel", $i_BitsPP) DllStructSetData($DEVMODE, "dmDisplayFrequency", $i_RefreshRate) $i_DllRet = DllCall($h_DLL_user32, "int", "ChangeDisplaySettingsEx", "ptr", 0, "ptr", DllStructGetPtr($DEVMODE), "hwnd", 0, "int", $CDS_TEST, "ptr", 0) If @error Then $DEVMODE = 0 SetError(2) Return 2 Else $i_DllRet = $i_DllRet[0] EndIf Select Case $i_DllRet = $DISP_CHANGE_SUCCESSFUL $i_DllRet = DllCall($h_DLL_user32, "int", "ChangeDisplaySettingsEx", "ptr", 0, "ptr", DllStructGetPtr($DEVMODE), "hwnd", 0, "int", $CDS_UPDATEREGISTRY, "ptr", 0) If @error Then $DEVMODE = 0 SetError(2) Return 3 Else $i_DllRet = $i_DllRet[0] EndIf If $i_DllRet <> $DISP_CHANGE_SUCCESSFUL Then $DEVMODE = 0 SetError($i_DllRet) Return 3 EndIf Return 0 ; Success ! Case Else $DEVMODE = 0 SetError($i_DllRet) Return 2 EndSelect EndIf $DEVMODE = 0 SetError(2) Return 1 EndFunc ;==>_ChangeScreenRes '?do=embed' frameborder='0' data-embedContent>> Edited September 10, 2014 by johnmcloud langtudongnai45 1 Link to comment Share on other sites More sharing options...
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