#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$hGUI = GUICreate("_ControlGetColor Example", 300, 200)
$nEdit = GUICtrlCreateEdit("", 20, 40, 260, 120)
GUISetState(@SW_SHOW, $hGUI)
$nOriginal_Color = 0xFFF0F0
GUICtrlSetBkColor($nEdit, $nOriginal_Color)
$nColor = _ControlGetColor($hGUI, "", $nEdit)
MsgBox(64, 'Title', _
StringFormat('Control set color:\t\t\t0x%X\nColor return from _ControlGetColor:\t0x%X\n\nColors are identical:\t\t\t%s', _
$nOriginal_Color, $nColor, ($nOriginal_Color == $nColor)))
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _ControlGetColor($sTitle, $sText, $iCtrlID)
Local $hCtrl, $aCtrlPos, $iOpt, $nColor
$hCtrl = ControlGetHandle($sTitle, $sText, $iCtrlID)
$aCtrlPos = ControlGetPos($sTitle, $sText, $iCtrlID)
$iOpt = Opt("PixelCoordMode", 0)
$nColor = PixelGetColor($aCtrlPos[0]+1, $aCtrlPos[1]+1, $hCtrl)
Opt("PixelCoordMode", $iOpt)
Return $nColor
EndFunc