Detailed Description

Theme wrapper functions.

This miscellaneous module provides wrapper of functions exported from UXTHEME.DLL, as the library is only available on Windows XP and later.

Note

mCtrl only uses UXTHEME.DLL if it is convinced the application is themed. I.e. it must be linked against COMCTL32.DLL version 6 or later, as earlier versions does not support themed controls and mCtrl tries to be consistent with rest of the application.

The wrapper function provided by this module simpply have the same name as functions exported from UXTHEME.DLL, with the prefix mc prepended. Each wrapper simply calls its counterpart in if it is loaded and available (as some UXTHEME.DLL functions were introduced later then on Windows XP).

If the UXTHEME.DLL is not used, or if the particulkar function is not available, then most of the wrapper functions just fail gracefully and return E_NOTIMPL, NULL, 0 or FALSE, depedning on the return type.

However there are also wrapper functions which provide some fallback implementation. Those cases are described in description of particvular functions.

Note

Note that future versions of mCtrl can provide fallback implementation for more functions. If you want directly call the UXTHEME.DLL function, then get its address manually with GetProcAddress().

Function Documentation

BOOL mcTheme_Initialize

(

void

)

Initializes the module. This function must be called before any other function of this module is used.

Note that the function checks version of Windows and version of COMCTL32.DLL. It only loads UXTHEME.DLL and gets

Returns

TRUE on success, FALSE on failure.

void mcTheme_Terminate

(

void

)

Uninitialization. If mcTheme_Initialize() loaded UXTHEME.DLL, is is unloaded with FreeLibrary() and releases any related resources.

HRESULT mcCloseThemeData

(

HTHEME

hTheme

)

Calls CloseThemeData() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

Returns

Return value of CloseThemeData() or E_NOTIMPL.

HRESULT mcDrawThemeBackground

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

const RECT *

prc,

const RECT *

prcClip

)

Calls DrawThemeBackground() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

prc

prcClip

Returns

Return value of DrawThemeBackground() or E_NOTIMPL.

HRESULT mcDrawThemeBackgroundEx

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

const RECT *

prc,

const DTBGOPTS *

pOptions

)

Calls DrawThemeBackgroundEx() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

prc

pOptions

Returns

Return value of DrawThemeBackgroundEx() or E_NOTIMPL.

HRESULT mcDrawThemeEdge

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

const RECT *

prcDest,

UINT

uEdge,

UINT

uFlags,

RECT *

prcContent

)

Calls DrawThemeEdge() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

prcDest

uEdge

uFlags

prcContent

Returns

Return value of DrawThemeEdge() or E_NOTIMPL.

HRESULT mcDrawThemeIcon

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

const RECT *

prc,

HIMAGELIST

himl,

int

iImageIndex

)

Calls DrawThemeIcon() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

prc

himl

iImageIndex

Returns

Return value of DrawThemeIcon() or E_NOTIMPL.

HRESULT mcDrawThemeParentBackground

(

HWND

hwnd,

HDC

hdc,

RECT *

prc

)

Calls DrawThemeParentBackground() if available (and UXTHEME.DLL is in use).

If it is not, the function fallbacks to asking the parent to paint itself by sending WM_ERASEBKGND and WM_PRINTCLIENT.

Parameters

hwnd

hdc

prc

Returns

Return value of DrawThemeParentBackground() or S_OK.

HRESULT mcDrawThemeText

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

const WCHAR *

pszText,

int

iCharCount,

DWORD

dwFlags,

DWORD

dwFlags2,

const RECT *

prc

)

Calls DrawThemeText() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

pszText

iCharCount

dwFlags

dwFlags2

prc

Returns

Return value of DrawThemeText() or E_NOTIMPL.

HRESULT mcEnableThemeDialogTexture

(

HWND

hwnd,

DWORD

dwFlags

)

Calls EnableThemeDialogTexture() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hwnd

dwFlags

Returns

Return value of EnableThemeDialogTexture() or E_NOTIMPL.

HRESULT mcGetCurrentThemeName

(

WCHAR *

pszThemeFilename,

int

cchMaxFilenameChars,

WCHAR *

pszColorBuff,

int

cchMaxColorChars,

WCHAR *

pszSizeBuff,

int

cchMaxSizeChars

)

Calls GetCurrentThemeName() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

pszThemeFilename

cchMaxFilenameChars

pszColorBuff

cchMaxColorChars

pszSizeBuff

cchMaxSizeChars

Returns

Return value of GetCurrentThemeName() or E_NOTIMPL.

DWORD mcGetThemeAppProperties

(

void

)

Calls GetThemeAppProperties() if available (and UXTHEME.DLL is in use), or returns NULL.

Returns

Return value of GetThemeAppProperties() or 0.

HRESULT mcGetThemeBackgroundContentRect

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

const RECT *

prcBounding,

RECT *

prcContent

)

Calls GetThemeBackgroundContentRect() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

prcBounding

prcContent

Returns

Return value of GetThemeBackgroundContentRect() or E_NOTIMPL.

HRESULT mcGetThemeBackgroundExtent

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

const RECT *

prcContent,

RECT *

prcExtent

)

Calls GetThemeBackgroundExtent() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

prcContent

prcExtent

Returns

Return value of GetThemeBackgroundExtent() or E_NOTIMPL.

HRESULT mcGetThemeBackgroundRegion

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

const RECT *

prc,

HRGN *

phRegion

)

Calls GetThemeBackgroundRegion() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

prc

phRegion

Returns

Return value of GetThemeBackgroundRegion() or E_NOTIMPL.

HRESULT mcGetThemeBool

(

HTHEME

hTheme,

int

iPartId,

int

iStateId,

int

iPropId,

BOOL *

pfValue

)

Calls GetThemeBool() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

iPartId

iStateId

iPropId

pfValue

Returns

Return value of GetThemeBool() or E_NOTIMPL.

HRESULT mcGetThemeColor

(

HTHEME

hTheme,

int

iPartId,

int

iStateId,

int

iPropId,

COLORREF *

pColor

)

Calls GetThemeColor() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

iPartId

iStateId

iPropId

pColor

Returns

Return value of GetThemeColor() or E_NOTIMPL.

HRESULT mcGetThemeDocumentationProperty

(

const WCHAR *

pszThemeName,

const WCHAR *

pszPropName,

WCHAR *

pszValueBuf,

int

cchMaxValChars

)

Calls GetThemeDocumentationProperty() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

pszThemeName

pszPropName

pszValueBuf

cchMaxValChars

Returns

Return value of GetThemeDocumentationProperty() or E_NOTIMPL.

HRESULT mcGetThemeEnumValue

(

HTHEME

hTheme,

int

iPartId,

int

iStateId,

int

iPropId,

int *

piValue

)

Calls GetThemeEnumValue() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

iPartId

iStateId

iPropId

piValue

Returns

Return value of GetThemeEnumValue() or E_NOTIMPL.

HRESULT mcGetThemeFilename

(

HTHEME

hTheme,

int

iPartId,

int

iStateId,

int

iPropId,

WCHAR *

pszThemeFilename,

int

cchMaxBuffChars

)

Calls GetThemeFilename() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

iPartId

iStateId

iPropId

pszThemeFilename

cchMaxBuffChars

Returns

Return value of GetThemeFilename() or E_NOTIMPL.

HRESULT mcGetThemeFont

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

int

iPropId,

LOGFONTW *

pLogFont

)

Calls GetThemeFont() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

iPropId

pLogFont

Returns

Return value of GetThemeFont() or E_NOTIMPL.

HRESULT mcGetThemeInt

(

HTHEME

hTheme,

int

iPartId,

int

iStateId,

int

iPropId,

int *

piValue

)

Calls GetThemeInt() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

iPartId

iStateId

iPropId

piValue

Returns

Return value of GetThemeInt() or E_NOTIMPL.

HRESULT mcGetThemeIntList

(

HTHEME

hTheme,

int

iPartId,

int

iStateId,

int

iPropId,

INTLIST *

pIntList

)

Calls GetThemeIntList() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

iPartId

iStateId

iPropId

pIntList

Returns

Return value of GetThemeIntList() or E_NOTIMPL.

HRESULT mcGetThemeMargins

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

int

iPropId,

RECT *

prc,

MARGINS *

pMargins

)

Calls GetThemeMargins() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

iPropId

prc

pMargins

Returns

Return value of GetThemeMargins() or E_NOTIMPL.

HRESULT mcGetThemeMetric

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

int

iPropId,

int *

piValue

)

Calls GetThemeMetric() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

iPropId

piValue

Returns

Return value of GetThemeMetric() or E_NOTIMPL.

HRESULT mcGetThemePartSize

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

const RECT *

prc,

enum THEMESIZE

eSize,

SIZE *

psz

)

Calls GetThemePartSize() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

prc

eSize

psz

Returns

Return value of GetThemePartSize() or E_NOTIMPL.

HRESULT mcGetThemePosition

(

HTHEME

hTheme,

int

iPartId,

int

iStateId,

int

iPropId,

POINT *

pPoint

)

Calls GetThemePosition() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

iPartId

iStateId

iPropId

pPoint

Returns

Return value of GetThemePosition() or E_NOTIMPL.

HRESULT mcGetThemePropertyOrigin

(

HTHEME

hTheme,

int

iPartId,

int

iStateId,

int

iPropId,

enum PROPERTYORIGIN *

pOrigin

)

Calls GetThemePropertyOrigin() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

iPartId

iStateId

iPropId

pOrigin

Returns

Return value of GetThemePropertyOrigin() or E_NOTIMPL.

HRESULT mcGetThemeRect

(

HTHEME

hTheme,

int

iPartId,

int

iStateId,

int

iPropId,

RECT *

prc

)

Calls GetThemeRect() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

iPartId

iStateId

iPropId

prc

Returns

Return value of GetThemeRect() or E_NOTIMPL.

HRESULT mcGetThemeString

(

HTHEME

hTheme,

int

iPartId,

int

iStateId,

int

iPropId,

WCHAR *

pszBuff,

int

cchMaxBuffChars

)

Calls GetThemeString() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

iPartId

iStateId

iPropId

pszBuff

cchMaxBuffChars

Returns

Return value of GetThemeString() or E_NOTIMPL.

BOOL mcGetThemeSysBool

(

HTHEME

hTheme,

int

iBoolId

)

Calls GetThemeSysBool() if available (and UXTHEME.DLL is in use).

If it is not, mCtrl falls back to heuristics based on information from SystemParametersInfo().

Parameters

hTheme

iBoolId

Returns

Return value of GetThemeSysBool(), or from the fallback implementation.

COLORREF mcGetThemeSysColor

(

HTHEME

hTheme,

int

iColorId

)

Calls GetThemeSysColor() if available (and UXTHEME.DLL is in use). If it is not, mCtrl falls back to GetSysColor().

Parameters

hTheme

iColorId

Returns

Return value of GetThemeSysColor(), or from GetSysColor().

HBRUSH mcGetThemeSysColorBrush

(

HTHEME

hTheme,

int

iBrushId

)

Calls GetThemeSysColorBrush() if available (and UXTHEME.DLL is in use). If it is not, mCtrl falls back to implementation based on GetSysColor().

Parameters

hTheme

iBrushId

Returns

Return value of GetThemeSysColor(), or from the fallback implementation.

HRESULT mcGetThemeSysFont

(

HTHEME

hTheme,

int

iFontId,

LOGFONTW *

pLogFont

)

Calls GetThemeSysFont() if available (and UXTHEME.DLL is in use). If it is not, mCtrl falls back to implementation based on SystemParameterInfo().

Parameters

hTheme

iFontId

pLogFont

Returns

Return value of GetThemeSysFont(), or a HRESULT based on success of the fallback implementation.

HRESULT mcGetThemeSysInt

(

HTHEME

hTheme,

int

iIntId,

int *

piValue

)

Calls GetThemeSysInt() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

iIntId

piValue

Returns

Return value of GetThemeSysInt(), or E_NOTIMPL.

int mcGetThemeSysSize

(

HTHEME

hTheme,

int

iSizeId

)

Calls GetThemeSysSize() if available (and UXTHEME.DLL is in use), or falls back to implementation based on GetSystemMetrics().

Parameters

hTheme

iSizeId

Returns

Return value of GetThemeSysSize(), or from the fallback implementation.

HRESULT mcGetThemeSysString

(

HTHEME

hTheme,

int

iStringId,

WCHAR *

pszBuff,

int

cchMaxBuffChars

)

Calls GetThemeSysString() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

iStringId

pszBuff

cchMaxBuffChars

Returns

Return value of GetThemeSysSize(), or E_NOTIMPL.

HRESULT mcGetThemeTextExtent

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

const TCHAR *

pszText,

int

cchTextMax,

DWORD

dwFlags,

const RECT *

prcBounding,

RECT *

prcExtent

)

Calls GetThemeTextExtent() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

pszText

cchTextMax

dwFlags

prcBounding

prcExtent

Returns

Return value of GetThemeTextExtent(), or E_NOTIMPL.

HRESULT mcGetThemeTextMetrics

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

TEXTMETRIC *

pTextMetric

)

Calls GetThemeTextMetrics() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

pTextMetric

Returns

Return value of GetThemeTextMetrics(), or E_NOTIMPL.

HTHEME mcGetWindowTheme

(

HWND

hwnd

)

Calls GetWindowTheme() if available (and UXTHEME.DLL is in use), or returns NULL.

Parameters

hwnd

Returns

Return value of GetWindowTheme(), or NULL.

HRESULT mcHitTestThemeBackground

(

HTHEME

hTheme,

HDC

hdc,

int

iPartId,

int

iStateId,

DWORD

dwOptions,

const RECT *

prc,

HRGN

hrgn,

POINT

ptTest,

WORD *

pwHitTestCode

)

Calls HitTestThemeBackground() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hTheme

hdc

iPartId

iStateId

dwOptions

prc

hrgn

ptTest

pwHitTestCode

Returns

Return value of HitTestThemeBackground(), or E_NOTIMPL.

BOOL mcIsAppThemed

(

void

)

Calls IsAppThemed() if available (and UXTHEME.DLL is in use), or returns FALSE.

Returns

Return value of IsAppThemed(), or FALSE.

BOOL mcIsThemeActive

(

void

)

Calls IsThemeActive() if available (and UXTHEME.DLL is in use), or returns FALSE.

Returns

Return value of IsThemeActive(), or FALSE.

BOOL mcIsThemeBackgroundPartiallyTransparent

(

HTHEME

hTheme,

int

iPartId,

int

iStateId

)

Calls IsThemeBackgroundPartiallyTransparent() if available (and UXTHEME.DLL is in use), or returns FALSE.

Parameters

hTheme

iPartId

iStateId

Returns

Return value of IsThemeBackgroundPartiallyTransparent(), or FALSE.

BOOL mcIsThemeDialogTextureEnabled

(

HWND

hwnd

)

Calls IsThemeDialogTextureEnabled() if available (and UXTHEME.DLL is in use), or returns FALSE.

Parameters

hwnd

Returns

Return value of IsThemeDialogTextureEnabled(), or FALSE.

BOOL mcIsThemePartDefined

(

HTHEME

hTheme,

int

iPartId,

int

iStateId

)

Calls IsThemePartDefined() if available (and UXTHEME.DLL is in use), or returns FALSE.

Parameters

hTheme

iPartId

iStateId

Returns

Return value of IsThemePartDefined(), or FALSE.

HTHEME mcOpenThemeData

(

HWND

hwnd,

const WCHAR *

pszClassList

)

Calls OpenThemeData() if available (and UXTHEME.DLL is in use), or returns MULL.

Parameters

hwnd

pszClassList

Returns

Return value of OpenThemeData(), or FALSE.

HTHEME mcOpenThemeDataEx

(

HWND

hwnd,

const WCHAR *

pszClassList,

DWORD

dwFlags

)

Calls OpenThemeDataEx() if available (and UXTHEME.DLL is in use), or returns MULL.

Parameters

hwnd

pszClassList

dwFlags

Returns

Return value of OpenThemeDataEx(), or FALSE.

void mcSetThemeAppProperties

(

DWORD

dwFlags

)

Calls SetThemeAppProperties() if available (and UXTHEME.DLL is in use).

Parameters

dwFlags

HRESULT mcSetWindowTheme

(

HWND

hwnd,

const WCHAR *

pszSubAppName,

const WCHAR *

pszSubIdList

)

Calls SetWindowTheme() if available (and UXTHEME.DLL is in use), or returns E_NOTIMPL.

Parameters

hwnd

pszSubAppName

pszSubIdList

Returns

Return value of SetWindowTheme(), or E_NOTIMPL.

BOOL mcUpdatePanningFeedback

(

HWND

hwnd,

LONG

lTotalOverpanOffsetX,

LONG

lTotalOverpanOffsetY,

BOOL

fInInertia

)

Calls UpdatePanningFeedback() if available (and UXTHEME.DLL is in use), or returns FALSE.