snowman533 Posted April 27, 2009 Share Posted April 27, 2009 hey guys i need help, error and question is in the code expandcollapse popup#Include <WinAPI.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> dim $COLOR_WINDOW dim $COLOR_ACTIVEBORDER dim $COLOR_3DFACE $test= _WinAPI_GetSysColor($COLOR_ACTIVEBORDER) $test2= _WinAPI_GetSysColor($COLOR_3DFACE) msgbox(0,"test 1","active window border color is: " & $test) msgbox(0,"test 2","3D Face color is: " & $test2) _WinAPI_SetBkColor($COLOR_WINDOW, 0xFF00FF); Error: $COLOR_WINDOW previously declared as Const sleep(60000) #cs the objective of this script is to give the user the ability to change the color of the windows elements to suit a favorite color scheme without replacing any files, the problem i am having is, a value is reported as previously declared as a "Const" What do i do? reference list of the _WinAPI_GetSysColor: The display element whose color is to be retrieved. Can be one of the following: $COLOR_3DDKSHADOW - Dark shadow for three-dimensional display elements. $COLOR_3DFACE - Face color for three-dimensional display elements and for dialog box backgrounds. $COLOR_3DHIGHLIGHT - Highlight color for three-dimensional display elements (for edges facing the light source.) $COLOR_3DHILIGHT - Highlight color for three-dimensional display elements (for edges facing the light source.) $COLOR_3DLIGHT - Light color for three-dimensional display elements (for edges facing the light source.) $COLOR_3DSHADOW - Shadow color for three-dimensional display elements (for edges facing away from the light source). $COLOR_ACTIVEBORDER - Active window border. $COLOR_ACTIVECAPTION - Active window title bar. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled. $COLOR_APPWORKSPACE - Background color of multiple document interface (MDI) applications. $COLOR_BACKGROUND - Desktop. $COLOR_BTNFACE - Face color for three-dimensional display elements and for dialog box backgrounds. $COLOR_BTNHIGHLIGHT - Highlight color for three-dimensional display elements (for edges facing the light source.) $COLOR_BTNHILIGHT - Highlight color for three-dimensional display elements (for edges facing the light source.) $COLOR_BTNSHADOW - Shadow color for three-dimensional display elements (for edges facing away from the light source). $COLOR_BTNTEXT - Text on push buttons. $COLOR_CAPTIONTEXT - Text in caption, size box, and scroll bar arrow box. $COLOR_DESKTOP - Desktop. $COLOR_GRADIENTACTIVECAPTION - Right side color in the color gradient of an active window's title bar. $COLOR_ACTIVECAPTION specifies the left side color. Use SPI_GETGRADIENTCAPTIONS with the SystemParametersInfo function to determine whether the gradient effect is enabled. $COLOR_GRADIENTINACTIVECAPTION - Right side color in the color gradient of an inactive window's title bar. $COLOR_INACTIVECAPTION specifies the left side color. $COLOR_GRAYTEXT - Grayed (disabled) text. This color is set to 0 if the current display driver does not support a solid gray color. $COLOR_HIGHLIGHT - Item(s) selected in a control. $COLOR_HIGHLIGHTTEXT - Text of item(s) selected in a control. $COLOR_HOTLIGHT - Color for a hyperlink or hot-tracked item. $COLOR_INACTIVEBORDER - Inactive window border. $COLOR_INACTIVECAPTION - Inactive window caption. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled. $COLOR_INACTIVECAPTIONTEXT - Color of text in an inactive caption. $COLOR_INFOBK - Background color for tooltip controls. $COLOR_INFOTEXT - Text color for tooltip controls. $COLOR_MENU - Menu background. $COLOR_MENUHILIGHT - The color used to highlight menu items when the menu appears as a flat menu. The highlighted menu item is outlined with $COLOR_HIGHLIGHT. Windows 2000: This value is not supported. $COLOR_MENUBAR - The background color for the menu bar when menus appear as flat menus. However, $COLOR_MENU continues to specify the background color of the menu popup. Windows 2000: This value is not supported. $COLOR_MENUTEXT - Text in menus. $COLOR_SCROLLBAR - Scroll bar gray area. $COLOR_WINDOW - Window background. $COLOR_WINDOWFRAME - Window frame. $COLOR_WINDOWTEXT - Text in windows. #ce thanks in advance Intermediate AutoIt/Autohotkey User Link to comment Share on other sites More sharing options...
Authenticity Posted April 27, 2009 Share Posted April 27, 2009 (edited) lol, you can read the error then you should understand it too. If the variable previously declared as constant then why there is Dim $COLOR_window... in the source?Either, remove your declaration statements or don't include WindowsConstants.au3 Edited April 27, 2009 by Authenticity Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 27, 2009 Moderators Share Posted April 27, 2009 snowman533,Do not declare $COLOR_WINDOW yourself. It has already been declared as a constant in WindowsConstants.au3 and that is what gives you the error.By the way, the first parameter of _WinAPI_SetBkColor is the handle to the device context, not the constant value of the item to change, and you need to use _WinAPI_GetDC to find that. You should look at the example in the Help file more closely!M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
snowman533 Posted April 27, 2009 Author Share Posted April 27, 2009 (edited) thanks, no more errors, but i cant seem to make anything change color, expandcollapse popup#Include <WinAPI.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> $test= _WinAPI_GetSysColor($COLOR_ACTIVEBORDER) $test2= _WinAPI_GetSysColor($COLOR_3DFACE) msgbox(0,"test 1","active window border color is: " & $test) msgbox(0,"test 2","3D Face color is: " & $test2) _WinAPI_SetBkColor($COLOR_WINDOW, 0xFF0000) sleep(60000) #cs the objective of this script is to give the user the ability to change the color of the windows elements to suit a favorite color scheme without replacing any files What do i do? reference list of the _WinAPI_GetSysColor: The display element whose color is to be retrieved. Can be one of the following: $COLOR_3DDKSHADOW - Dark shadow for three-dimensional display elements. $COLOR_3DFACE - Face color for three-dimensional display elements and for dialog box backgrounds. $COLOR_3DHIGHLIGHT - Highlight color for three-dimensional display elements (for edges facing the light source.) $COLOR_3DHILIGHT - Highlight color for three-dimensional display elements (for edges facing the light source.) $COLOR_3DLIGHT - Light color for three-dimensional display elements (for edges facing the light source.) $COLOR_3DSHADOW - Shadow color for three-dimensional display elements (for edges facing away from the light source). $COLOR_ACTIVEBORDER - Active window border. $COLOR_ACTIVECAPTION - Active window title bar. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled. $COLOR_APPWORKSPACE - Background color of multiple document interface (MDI) applications. $COLOR_BACKGROUND - Desktop. $COLOR_BTNFACE - Face color for three-dimensional display elements and for dialog box backgrounds. $COLOR_BTNHIGHLIGHT - Highlight color for three-dimensional display elements (for edges facing the light source.) $COLOR_BTNHILIGHT - Highlight color for three-dimensional display elements (for edges facing the light source.) $COLOR_BTNSHADOW - Shadow color for three-dimensional display elements (for edges facing away from the light source). $COLOR_BTNTEXT - Text on push buttons. $COLOR_CAPTIONTEXT - Text in caption, size box, and scroll bar arrow box. $COLOR_DESKTOP - Desktop. $COLOR_GRADIENTACTIVECAPTION - Right side color in the color gradient of an active window's title bar. $COLOR_ACTIVECAPTION specifies the left side color. Use SPI_GETGRADIENTCAPTIONS with the SystemParametersInfo function to determine whether the gradient effect is enabled. $COLOR_GRADIENTINACTIVECAPTION - Right side color in the color gradient of an inactive window's title bar. $COLOR_INACTIVECAPTION specifies the left side color. $COLOR_GRAYTEXT - Grayed (disabled) text. This color is set to 0 if the current display driver does not support a solid gray color. $COLOR_HIGHLIGHT - Item(s) selected in a control. $COLOR_HIGHLIGHTTEXT - Text of item(s) selected in a control. $COLOR_HOTLIGHT - Color for a hyperlink or hot-tracked item. $COLOR_INACTIVEBORDER - Inactive window border. $COLOR_INACTIVECAPTION - Inactive window caption. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled. $COLOR_INACTIVECAPTIONTEXT - Color of text in an inactive caption. $COLOR_INFOBK - Background color for tooltip controls. $COLOR_INFOTEXT - Text color for tooltip controls. $COLOR_MENU - Menu background. $COLOR_MENUHILIGHT - The color used to highlight menu items when the menu appears as a flat menu. The highlighted menu item is outlined with $COLOR_HIGHLIGHT. Windows 2000: This value is not supported. $COLOR_MENUBAR - The background color for the menu bar when menus appear as flat menus. However, $COLOR_MENU continues to specify the background color of the menu popup. Windows 2000: This value is not supported. $COLOR_MENUTEXT - Text in menus. $COLOR_SCROLLBAR - Scroll bar gray area. $COLOR_WINDOW - Window background. $COLOR_WINDOWFRAME - Window frame. $COLOR_WINDOWTEXT - Text in windows. #ce at the moment i want the background of the file explorer to change, not the part where the files and folders are listed but in the menu part, or whatever you call it what am i missing, thanks in advance @Melba, sorry i didnt see your post, must have been made while i was editing, ill have a look at that Edited April 27, 2009 by snowman533 Intermediate AutoIt/Autohotkey User Link to comment Share on other sites More sharing options...
snowman533 Posted April 27, 2009 Author Share Posted April 27, 2009 (edited) wth the DC for the file explorer keeps changing :/ tried: _WinAPI_SetBkColor(_WinAPI_GetDC("My Computer"), 0xFF0000) with no luck (nothing happens) also changed sleep (60000) to While 1 sleep(10) Wend *edit* the example for _WinAPI_GetDC is for a GUI that you have coded, not for anything outside of it Edited April 27, 2009 by snowman533 Intermediate AutoIt/Autohotkey User Link to comment Share on other sites More sharing options...
Kip Posted April 27, 2009 Share Posted April 27, 2009 Try this: _WinAPI_SetBkColor(_WinAPI_GetDC(WinGetHandle("My Computer")), 0xFF0000) _WinAPI_GetDC() takes a handle, not just a window title. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
snowman533 Posted April 27, 2009 Author Share Posted April 27, 2009 (edited) tried above, still nothing happening how would i get the handle of the file Explorer? thats what i seem to need Edited April 27, 2009 by snowman533 Intermediate AutoIt/Autohotkey User Link to comment Share on other sites More sharing options...
Kip Posted April 27, 2009 Share Posted April 27, 2009 That's because _WinAPI_SetBkColor() isn't made for setting a window background color. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
snowman533 Posted April 27, 2009 Author Share Posted April 27, 2009 then how do i do what i want to do with the script? can someone point me in the right direction plz? Intermediate AutoIt/Autohotkey User Link to comment Share on other sites More sharing options...
Kip Posted April 27, 2009 Share Posted April 27, 2009 (edited) A quote from an other forum:Do you mean the background color of a simple dialog? If you do, you can either handle the WM_ERASEBKGND message and clear the background in the color you like (using FillRect()), or set the background brush using SetClassLong on your dialog's window class.WM_ERASEBKGND (msnd)FillRect() (msdn)Enjoy Edited April 27, 2009 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
snowman533 Posted April 27, 2009 Author Share Posted April 27, 2009 yes as well as items such as the taskbar and start button thanks in advance @Kip: ill have a look at that later, that should sort out normal boxes such as moving/copying files Intermediate AutoIt/Autohotkey User 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