Causes an existing window to use a different set of theme information than its class normally uses.
Syntax
HRESULT SetWindowTheme( HWND hwnd, LPCWSTR pstrSubAppName, LPCWSTR pstrSubIdList );
Parameters
- hwnd
- Handle to the window whose theme information is to be changed.
- pstrSubAppName
- 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 actual calling application's name is used.
- pstrSubIdList
- Pointer to a string that contains a semicolon-separated list of class identifier names to use in place of the actual list passed by the window's class. If this parameter is NULL, the identifier 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 pstrSubAppName and the pstrSubIdList associations through the lifetime of the window, even if themes are subsequently changed. The window is sent a WM_THEMECHANGED message at the end of a SetWindowTheme call, so that the new theme can be found and applied.
When pstrSubAppName and pstrSubIdList are NULL, the theme manager removes the previously applied associations. To turn off theme-awareness for the specified window, pass an empty string, (L" "), which will not match any section entries.
Function Information
Stock Implementation UxTheme.dll Custom Implementation No Header ThemeApi.h Import library UxTheme.lib Minimum operating systems Windows NT Whistler