Note: Requires WinAPIEx.au3 to use GUIGetBkColor().
To get the Hex value e.g. 00FF00 then use this little conversion >>
Function:
; #FUNCTION# ==================================================================================================================== ; Name ..........: GUIGetBkColor ; Description ...: Retrieves the RGB value of the GUI background. ; Syntax ........: GUIGetBkColor($hWnd) ; Parameters ....: $hWnd - A handle of the GUI. ; Return values .: Success - RGB value ; Failure - 0 ; Author ........: guinness ; Remarks .......: WinAPIEx is required. ; Example .......: Yes ; =============================================================================================================================== Func GUIGetBkColor($hWnd) If IsHWnd($hWnd) = 0 Then Return 0 EndIf Local $hDC = _WinAPI_GetDC($hWnd) Local $iColor = _WinAPI_GetBkColor($hDC) _WinAPI_ReleaseDC($hWnd, $hDC) Return $iColor EndFunc ;==>GUIGetBkColor
Example use of Function:
#include <WinAPIEx.au3> ; Required for _WinAPI_GetBkColor() #include 'GUIGetBkColor.au3' Example() Func Example() Local $aColor[6] = [5, 0x0000FF, 0x8FFF9F, 0xEC4841, 0xB0E35D, 0x440BFD] ; Random Color Array. Local $iColor = 0 Local $hGUI = GUICreate('GUIGetBkColor() Example', 500, 350) GUISetState(@SW_SHOW, $hGUI) For $i = 1 To $aColor[0] GUISetBkColor($aColor[$i]) Sleep(20) $iColor = GUIGetBkColor($hGUI) ; Pass the GUI Handle to the Function. MsgBox(4096, '', 'Background Color: ' & _ConvertToHexFormat($aColor[$i]) & @CRLF & _ 'GUIGetBkColor() Hex Format: ' & _ConvertToHexFormat($iColor) & @CRLF & _ 'GUIGetBkColor() Returned: ' & $iColor, 0, $hGUI) Next GUIDelete($hGUI) EndFunc ;==>Example Func _ConvertToHexFormat($bColor) Return Hex($bColor, 6) EndFunc ;==>_ConvertToHexFormat
Edited by guinness, 17 October 2012 - 08:08 PM.



