Function Reference


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

#include <WinAPITheme.au3>
_WinAPI_SetWindowTheme ( $hWnd [, $sName = Default [, $sList = Default]] )


$hWnd Handle to the window whose visual style information is to be changed.
$sName [optional] A string that contains the application name. If this parameter is 0 (Default), the calling application's name is used.
$sList [optional] 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 0 (Default), the ID list from the calling class is used.

Return Value

Success: 1.
Failure: 0 and sets the @error flag to non-zero, @extended flag may contain the HRESULT error code.


The theme manager retains the $sName and the $sList associations through the lifetime of the window, even
if visual styles subsequently change.

When $sName and $sList are Default, the theme manager removes the previously applied associations.
To prevent visual styles from being applied to a specified window, add a _WinAPI_SetWindowTheme($hWnd, "", "") which will not match any section entries.

See Also

Search SetWindowTheme in MSDN Library.


#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WinAPISys.au3>
#include <WinAPITheme.au3>

If Number(_WinAPI_GetVersion()) < 6.0 Then
    MsgBox(BitOR($MB_ICONERROR, $MB_SYSTEMMODAL), 'Error', 'Require Windows Vista or later.')

GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 332, 400)

Local $idListview = GUICtrlCreateListView('Column 1|Column 2|Column 3|Column 4', 10, 10, 312, 380)
For $i = 1 To 9
    GUICtrlCreateListViewItem('Item ' & $i & '|' & 'Sub ' & $i & '|' & 'Sub ' & $i & '|' & 'Sub ' & $i, $idListview)

_WinAPI_SetWindowTheme(GUICtrlGetHandle($idListview), 'Explorer')