SetWindowTheme function (uxtheme.h)
Causes a window to use a different set of visual style information than its class normally uses.
Syntax
HRESULT SetWindowTheme(
[in] HWND hwnd,
[in] LPCWSTR pszSubAppName,
[in] LPCWSTR pszSubIdList
);
Parameters
[in] hwnd
Type: HWND
Handle to the window whose visual style information is to be changed.
[in] pszSubAppName
Type: LPCWSTR
Pointer to a string that contains the application name to use in place of the calling application's name. If this parameter is NULL, the calling application's name is used.
[in] pszSubIdList
Type: LPCWSTR
Pointer to a string that contains a semicolon-separated list of CLSID names to use in place of the actual list passed by the window's class. If this parameter is NULL, the ID list from the calling class is used.
Return value
Type: HRESULT
If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
The theme manager retains the pszSubAppName and the pszSubIdList associations through the lifetime of the window, even if visual styles subsequently change. The window is sent a WM_THEMECHANGED message at the end of a SetWindowTheme call, so that the new visual style can be found and applied.
When pszSubAppName and pszSubIdList are NULL, the theme manager removes the previously applied associations. You can prevent visual styles from being applied to a specified window by specifying an empty string, (L" "), which does not match any section entries.
Examples
The following example code gives a list-view control the appearance of a Windows Explorer list:
SetWindowTheme(hwndList, L"Explorer", NULL);
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | uxtheme.h |
Library | UxTheme.lib |
DLL | UxTheme.dll |