Changing System Colors
Keywords: system colors
Question:
How do you change system colors?Answer:
It is easy to write to the registry and update it to specify the system colors to be used on the next restart of Windows.It is somewhat more complicated to change the system colors for the current session. The code below shows how to do both.
element_string = "ActiveTitle"; From registry dataitem name element_offset = 2; Code from table below color_red = 255; red color value 0 to 255 color_green = 0; green color value 0 to 255 color_blue = 0; blue color value 0 to 255 ;--------------------------------------- ; This code sets the colors for the next restart. Easy RegSetValue(@REGCURRENT, "Control Panel\Colors\[%element_string%]", "%color_red% %color_green% %color_blue%") ; End of Next Restart code. ;This code sets the colors for the current session elements_buf = binaryalloc(4) values_buf = binaryalloc(4) BinaryPoke4(elements_buf, 0, element_offset) BinaryPoke4(values_buf, 0, color_red | (color_green << 8) | (color_blue << 16)) DaDll=strcat(DirWindows(1),"USER32.DLL") DllCall(DaDll, long:"SetSysColors", word:1, lpbinary:elements_buf, lpbinary:values_buf) BinaryFree(elements_buf) BinaryFree(values_buf) exit ;End of current session code exit ;;;;; ;Color offsets: ; 0 COLOR_SCROLLBAR ; 1 COLOR_BACKGROUND ; 2 COLOR_ACTIVECAPTION ; 3 COLOR_INACTIVECAPTION ; 4 COLOR_MENU ; 5 COLOR_WINDOW ; 6 COLOR_WINDOWFRAME ; 7 COLOR_MENUTEXT ; 8 COLOR_WINDOWTEXT ; 9 COLOR_CAPTIONTEXT ;10 COLOR_ACTIVEBORDER ;11 COLOR_INACTIVEBORDER ;12 COLOR_APPWORKSPACE ;13 COLOR_HIGHLIGHT ;14 COLOR_HIGHLIGHTTEXT ;15 COLOR_BTNFACE ;16 COLOR_BTNSHADOW ;17 COLOR_GRAYTEXT ;18 COLOR_BTNTEXT ;19 COLOR_INACTIVECAPTIONTEXT ;20 COLOR_BTNHIGHLIGHT ;21 COLOR_3DDKSHADOW ;22 COLOR_3DLIGHT ;23 COLOR_INFOTEXT ;24 COLOR_INFOBK
Article ID: W13209Filename: Change System Colors.txt