richs1000 Posted February 21, 2009 Posted February 21, 2009 We're developing an application with AutoIT v3 in WindowsXP which makes the following changes to some of the Desktop settings through the SystemParametersInfo(): * sets menu width to 18 * sets menu height to 19 * sets scroll width to 17 * sets scroll height to 17 * sets caption width to 25 * sets caption height to 17 * sets font size to 11 Here's the code I use to make the changes: CODE$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)) Global Const $SPI_GETNONCLIENTMETRICS = 41 Global Const $SPI_SETNONCLIENTMETRICS = 42 Global Const $SPIF_SENDCHANGE = 2 Global Const $SPIF_UPDATEINIFILE = 1 $a = DLLCall("user32.dll","int","SystemParametersInfo","int",$SPI_GETNONCLIENTMETRICS, _ "int",DllStructGetSize($nonclientmetrics), _ "ptr",DllStructGetPtr($nonclientmetrics),"int",0) $b = DLLCall("kernel32.dll","int","GetLastError") $logfont1 = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]",DLLStructGetPtr($nonclientmetrics,7)) $logfont2 = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]",DLLStructGetPtr($nonclientmetrics,10)) $logfont3 = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]",DLLStructGetPtr($nonclientmetrics,13)) $logfont4 = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]",DLLStructGetPtr($nonclientmetrics,14)) $logfont5 = DllStructCreate("long;long;long;long;long;byte;byte;byte;byte;byte;byte;byte;byte;char[32]",DLLStructGetPtr($nonclientmetrics,15)) $menuWidth = DllStructGetData($nonclientmetrics,11) $menuHeight = DllStructGetData($nonclientmetrics,12) ;set menu width to 18 DllStructSetData($nonclientmetrics,11,18) ;set menu height to 19 DllStructSetData($nonclientmetrics,12,19) ;set scroll width to 17 DllStructSetData($nonclientmetrics,3,17) ;set scroll height to 17 DllStructSetData($nonclientmetrics,4,17) ;set caption width to 25 DllStructSetData($nonclientmetrics,5,25) ;set caption height to 17 DllStructSetData($nonclientmetrics,4,17) ;set font size to 11 DllStructSetData($logfont3,1,-11) $a = DLLCall("user32.dll","int","SystemParametersInfo","int",$SPI_SETNONCLIENTMETRICS, _ "int",DllStructGetSize($nonclientmetrics), _ "ptr",DllStructGetPtr($nonclientmetrics),"int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE)) When we make these changes, the size of the small icons in the system tray changes from 16 to 22. I can verify this by calling the GetSystemMetrics() function and querying on SM_CXSMICON and SM_CYSMICON: CODEConst $SM_CXSIZE=30 Const $SM_CYSIZE=31 Const $SM_CXSMICON=49 Const $SM_CYSMICON=50 Const $SM_CXSMSIZE=52 Const $SM_CYSMSIZE=53 Const $SM_CYCAPTION=4 $xicosz=DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CXSMICON) $cxsmicon=$xicosz[0]; 19 or 26 $yicosz=DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CYSMICON) $cysmicon=$yicosz[0]; 19 or 26 $xsmsz=DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CXSMSIZE) $cxsmsize=$xsmsz[0]; 19 or 26 $ysmsz=DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CYSMSIZE) $cysmsize=$ysmsz[0]; 19 or 26 $xsz=DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CXSIZE) $cxsize=$xsz[0]; 19 or 26 $ysz=DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', $SM_CYSIZE) $cysize=$ysz[0]; 19 or 26 MsgBox(4096,"default values", _ "small icon x = " & $cxsmicon & @LF & _ "small icon y = " & $cysmicon & @LF & _ "small button x = " & $cxsmsize & @LF & _ "small button y = " & $cysmsize & @LF & _ "caption button x = " & $cxsize & @LF & _ "caption button y = " & $cysize) The only way I've found to return the system tray icons to their original size is to select the WindowsXP theme from the Display dialog box. Is there any way to prevent these values from changing? Or returning them to their original value? There does not seem to be any way to do this using SystemParametersInfo(), and there is no SetSystemMetrics() function. Thanks. rich
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