SetWindowTheme

 

Description

 

Causes a window to use a different set of visual style information than its class normally uses.

 

C++ Syntax

 

HRESULT SetWindowTheme(

HWND hwnd,

LPCWSTR pszSubAppName,

LPCWSTR pszSubIdList

);

 

PowerBASIC Syntax

 

FUNCTION SetWindowTheme ( _

BYVAL hwnd AS DWORD, _

BYVAL pszSubAppName AS DWORD, _

BYVAL pszSubIdList AS DWORD _

) AS LONG

 

Parameters

 

hTheme

 

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

 

pszSubAppName

 

[in] 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] Pointer to a string that contains a semicolon-separated list of class identifier (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

 

Returns S_OK if successful, or an error value otherwise.

 

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. To prevent visual styles from being applied to a specified window, pass an empty unicode string, which will not match any section entries.

 

Example

 

The following example code gives a list-view control the appearance of a Windows Explorer list:

 

C++

 

SetWindowTheme(hwndList, L"Explorer", NULL);

 

PowerBASIC

 

LOCAL bstrSubAppName AS STRING

bstrSubAppName = UCODE$("Explorer")

SetWindowTheme(hwndList, STRPTR(bstrSubAppName), %NULL)

 

Function Information

 

Stock implementation

UxTheme.dll

Custom implementation

No

C++ Header

uxtheme.h

PB Header

uxtheme.inc

Import library

UxTheme.lib

Minimum oeprating systems

Windows XP

 

Valid XHTML 1.0 Transitional