kiboost Posted March 4, 2014 Posted March 4, 2014 Hi, I see how to get windows metrics, but how to set them ? I can load a reg file to set them, but have to close/reopen session to have them loaded. I'm looking for a way to force immediate change, just like changing them with UI. Win7 x64 #include <APIConstants.au3> #include <WinAPI.au3> $ActiveBarSize = _WinAPI_GetSystemMetrics($SM_CYSIZE) ConsoleWrite('size: '&$ActiveBarSize&@CR) Any idea ? Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79
kiboost Posted March 4, 2014 Author Posted March 4, 2014 I came with this with lot of inspiration from code here and there, but it doesn't change anything (the ui refresh anyway) ; $SM_CYSIZE : The height of a button in a window caption or title bar, in pixels. Global Const $SM_CYSIZE=31 Global Const $SPI_GETNONCLIENTMETRICS = 41 Global Const $SPI_SETNONCLIENTMETRICS = 42 Global Const $SPIF_SENDCHANGE = 2 Global Const $SPIF_UPDATEINIFILE = 1 $nonclientmetrics = DllStructCreate("uint;int;int;int;int;int;byte[60];int;int;byte[60];int;int;byte[60];byte[60];byte[60]") DLLStructSetData($nonclientmetrics,1,DllStructGetSize($nonclientmetrics)) ;initialize values to not reset all others ! $a = DLLCall("user32.dll","int","SystemParametersInfo","int",$SPI_GETNONCLIENTMETRICS, _ "int",DllStructGetSize($nonclientmetrics), _ "ptr",DllStructGetPtr($nonclientmetrics),"int",0) ;$b = DLLCall("kernel32.dll","int","GetLastError") ;ConsoleWrite('error: '&$b&@CR) DllStructSetData($nonclientmetrics, $SM_CYSIZE, 15) ;force refresh ! $a = DLLCall("user32.dll","int","SystemParametersInfo","int",$SPI_SETNONCLIENTMETRICS, _ "int",DllStructGetSize($nonclientmetrics), _ "ptr",DllStructGetPtr($nonclientmetrics),"int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79
kiboost Posted March 5, 2014 Author Posted March 5, 2014 Seems I was not usng the right value Global Const $SPI_GETNONCLIENTMETRICS = 0x0029 Global Const $SPI_SETNONCLIENTMETRICS = 0x002A Global Const $SPIF_UPDATEINIFILE = 0x0001 Global Const $SPIF_SENDWININICHANGE = 0x0002 Global Const $SPIF_SENDCHANGE = $SPIF_SENDWININICHANGE Global Const $SPI_SETBORDER = 0x0006 $nonclientmetrics = DllStructCreate("uint;int;int;int;int;int;byte[60];int;int;byte[60];int;int;byte[60];byte[60];byte[60]") DLLStructSetData($nonclientmetrics,1,DllStructGetSize($nonclientmetrics)) ;initialize values to not reset all others ! $a = DLLCall("user32.dll","int","SystemParametersInfo","int",$SPI_GETNONCLIENTMETRICS, _ "int",DllStructGetSize($nonclientmetrics), _ "ptr",DllStructGetPtr($nonclientmetrics),"int",0) DllStructSetData($nonclientmetrics, $SPI_SETBORDER, 15) ;force refresh ! $a = DLLCall("user32.dll","int","SystemParametersInfo","int",$SPI_SETNONCLIENTMETRICS, _ "int",DllStructGetSize($nonclientmetrics), _ "ptr",DllStructGetPtr($nonclientmetrics),"int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79
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