SetWindowTheme (uxtheme)
Last changed: -80.144.3.73

.
Summary
TODO - a short description

C# Signature:

[DllImport("uxtheme.dll", SetLastError=true, ExactSpelling=true, CharSet=CharSet.Unicode)]

public static extern int SetWindowTheme(IntPtr hWnd, string pszSubAppName, string pszSubIdList);

VB.NET Signature:

Public Declare Auto Function SetWindowTheme Lib "uxtheme.dll" (hWnd As IntPtr, pszSubAppName As String, pszSubIdList As String) As Integer

User-Defined Types:

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

Returns HRESULT.

Tips & Tricks:

Please add some!

Sample Code for VB.NET:

    'These classes enable visual styles for ListView and TreeView controls
    'This method works for vista and above

    Module WinApi
    Public Declare Auto Function SetWindowTheme Lib "uxtheme.dll" (hWnd As IntPtr, pszSubAppName As String, pszSubIdList As String) As Integer
    End Module

    Public Class TreeView
    Inherits System.Windows.Forms.TreeView

    Protected Overrides Sub OnHandleCreated(e As EventArgs)
        MyBase.OnHandleCreated(e)

        If Not DesignMode AndAlso Environment.OSVersion.Platform = PlatformID.Win32NT AndAlso Environment.OSVersion.Version.Major >= 6 Then
        SetWindowTheme(Me.Handle, "explorer", Nothing)
        End If
    End Sub
    End Class

    Public Class ListView
    Inherits System.Windows.Forms.ListView

    Protected Overrides Sub OnHandleCreated(e As EventArgs)
        MyBase.OnHandleCreated(e)

        If Not DesignMode AndAlso Environment.OSVersion.Platform = PlatformID.Win32NT AndAlso Environment.OSVersion.Version.Major >= 6 Then
        SetWindowTheme(Me.Handle, "explorer", Nothing)
        End If
    End Sub
    End Class

Documentation

http://msdn.microsoft.com/en-us/library/bb759829(VS.85).aspx