Jump to content

This is a color: 88 87 104


Recommended Posts

88 87 104 is the background color for my desktop. I want to create a GUI with the same bkcolor, but it's not working. Here's an example:

$yourBkColor = RegRead('HKEY_CURRENT_USER\Control Panel\Colors', 'Background') 
ConsoleWrite('! Your background color is: ' & $yourBkColor & @CRLF)
GuiCreate('TESTING')

GuiSetBkColor($yourBkColor)

GuiSetState()

Do 
    Sleep(20)
Until GuiGetMsg() = -3

Edit: This is what that autoit window info application says the bk color is: 5789544

Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

How about:

#include <GuiConstants.au3>

$color = RegRead('HKEY_CURRENT_USER\Control Panel\Colors', 'Background')
$avColor = StringSplit($color, " ")
If $avColor[0] = 3 Then
    $color = ($avColor[1] * 256 * 256) + ($avColor[2] * 256) + $avColor[3]
    Opt("GuiOnEventMode", 1)
    GUICreate("Color: " & $color)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
    GUISetBkColor($color)
    GUISetState()

    While 1
        Sleep(20)
    WEnd
Else
    MsgBox(16, "Error", "Error: Did not get valid color from registry.")
EndIf

Func _Quit()
    Exit
EndFunc   ;==>_Quit

:rolleyes:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

How about:

#include <GuiConstants.au3>

$color = RegRead('HKEY_CURRENT_USER\Control Panel\Colors', 'Background')
$avColor = StringSplit($color, " ")
If $avColor[0] = 3 Then
    $color = ($avColor[1] * 256 * 256) + ($avColor[2] * 256) + $avColor[3]
    Opt("GuiOnEventMode", 1)
    GUICreate("Color: " & $color)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
    GUISetBkColor($color)
    GUISetState()

    While 1
        Sleep(20)
    WEnd
Else
    MsgBox(16, "Error", "Error: Did not get valid color from registry.")
EndIf

Func _Quit()
    Exit
EndFunc   ;==>_Quit

:rolleyes:

Yay! Thanks a ton for that!
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

need to convert the RGB values (decimal) to hex

88 = 58

87 = 57

104 = 68

then assemble them like this:

0x585768

to specify in your GUI

You've got the right idea, but it doesn't have to be done in Hex. The RGB color is a 24bit number that can be generated and worked with in binary, octal, decimal, or Hex. These are all valid ways to present the same number to us humans, the computer doesn't care which you use.

:rolleyes:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...