Export (0) Print
Expand All
Expand Minimize

SetWindowTheme function

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

hwnd [in]

Type: HWND

Handle to the window whose visual style information is to be changed.

pszSubAppName [in]

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.

pszSubIdList [in]

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

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Uxtheme.h

Library

UxTheme.lib

DLL

UxTheme.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft