# Function Reference

# _WinAPI_GetThemeColor

Retrieves the value of a color property

#include <WinAPITheme.au3>
_WinAPI_GetThemeColor ( $hTheme, $iPartID, $iStateID, $iPropID )

## Parameters

$hTheme | Handle to a window's specified theme data.
$iPartID | The part that contains the color property.
$iStateID | The state of the part.
$iPropID | The property to retrieve ($TMT_*).

## Return Value

Success: | The color value, in RGB.
Failure: | Sets the @error flag to non-zero, @extended flag may contain the HRESULT error code.

## See Also

Search GetThemeColor in MSDN Library.

## Example

    #include <GUIConstantsEx.au3>
    #include <WinAPIGdi.au3>
    #include <WinAPISysWin.au3>
    #include <WinAPITheme.au3>
    #include <WindowsSysColorConstants.au3>

    Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 400, 400)
    GUISetFont(8.5, 400, 0, 'MS Shell Dlg', $hForm)
    Local $idButton = GUICtrlCreateButton('Set Theme Color', 140, 368, 115, 23)
    GUICtrlCreateTab(7, 7, 388, 354)
    GUICtrlCreateTabItem('About')
    Local $idSlider = GUICtrlCreateSlider(20, 45, 360, 26)
    GUICtrlCreateTabItem('')
    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idButton
                GUICtrlSetBkColor($idSlider, _GetTabBodyColor($hForm))
                GUICtrlSetState($idButton, $GUI_DISABLE)
        EndSwitch
    WEnd

    Func _GetTabBodyColor($hForm)
        Local $iDefault = _WinAPI_SwitchColor(_WinAPI_GetSysColor($COLOR_3DFACE))

        Local $hTheme = _WinAPI_OpenThemeData($hForm, 'TAB')
        If @error Then
            Return $iDefault
        EndIf
        Local $iPart
        Switch @OSVersion
            Case 'WIN_XP', 'WIN_2003'
                $iPart = 10 ; TABP_BODY
            Case Else
                $iPart = 11 ; TABP_AEROWIZARDBODY
        EndSwitch
        Local $iColor = _WinAPI_GetThemeColor($hTheme, $iPart, 1, $TMT_FILLCOLORHINT)
        _WinAPI_CloseThemeData($hTheme)
        If $iColor < 0 Then
            Return $iDefault
        EndIf
        Return $iColor
    EndFunc   ;==>_GetTabBodyColor