Jump to content
Sign in to follow this  
snowman533

this is really annoying

Recommended Posts

snowman533

hey guys i need help, error and question is in the code

#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

Share this post


Link to post
Share on other sites
Authenticity

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 by Authenticity

Share this post


Link to post
Share on other sites
Melba23

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
snowman533

thanks, no more errors, but i cant seem to make anything change color,

#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 by snowman533

Intermediate AutoIt/Autohotkey User

Share this post


Link to post
Share on other sites
snowman533

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 by snowman533

Intermediate AutoIt/Autohotkey User

Share this post


Link to post
Share on other sites
Kip

Try this:

_WinAPI_SetBkColor(_WinAPI_GetDC(WinGetHandle("My Computer")), 0xFF0000)

_WinAPI_GetDC() takes a handle, not just a window title.

Share this post


Link to post
Share on other sites
snowman533

tried above, still nothing happening

how would i get the handle of the file Explorer? thats what i seem to need

Edited by snowman533

Intermediate AutoIt/Autohotkey User

Share this post


Link to post
Share on other sites
snowman533

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

Share this post


Link to post
Share on other sites
Kip

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 by Kip

Share this post


Link to post
Share on other sites
snowman533

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×