Page 1 of 1

'Explorer' theme for ListViews & TreeViews on Vista+

Posted: 16 Jul 2015, 03:01
by just me
Related: viewtopic.php?f=13&t=8685

As long as it isn't implemented, you might want to use this function or similar:

Code: Select all

SetExplorerTheme(HCTL) { ; HCTL : handle of a ListView or TreeView control
   If (DllCall("GetVersion", "UChar") > 5) {
      VarSetCapacity(ClassName, 1024, 0)
      If DllCall("GetClassName", "Ptr", HCTL, "Str", ClassName, "Int", 512, "Int")
         If (ClassName = "SysListView32") || (ClassName = "SysTreeView32")
            Return !DllCall("UxTheme.dll\SetWindowTheme", "Ptr", HCTL, "WStr", "Explorer", "Ptr", 0)
   }
   Return False
}

Re: 'Explorer' theme for ListViews & TreeViews on Vista+

Posted: 16 Jul 2015, 04:07
by tmplinshi
Nice!

Re: 'Explorer' theme for ListViews & TreeViews on Vista+

Posted: 17 Jul 2015, 03:58
by tmplinshi
For who also want to remove the listview's selection border:

Reference: http://stackoverflow.com/questions/2691 ... stviewitem

Code: Select all

LV_RemoveSelBorder(HLV, a*) {
	Static WM_CHANGEUISTATE := 0x127
	     , WM_UPDATEUISTATE := 0x128
	     , UIS_SET := 1
	     , UISF_HIDEFOCUS := 0x1
	     , wParam := (UIS_SET << 16) | (UISF_HIDEFOCUS & 0xffff) ; MakeLong
	     , _ := OnMessage(WM_UPDATEUISTATE, "LV_RemoveSelBorder")
	If (a.2 = WM_UPDATEUISTATE)
		Return 0 ; Prevent alt key from restoring the selection border
	PostMessage, WM_CHANGEUISTATE, wParam, 0,, % "ahk_id " . HLV
}

Re: 'Explorer' theme for ListViews & TreeViews on Vista+

Posted: 14 Aug 2017, 04:50
by Fords
Hello just me,

Is it possible to hide columns lines line like in explorer? -grid has no effect.
http://i.imgur.com/WA9w7WL.png

Thanks

Re: 'Explorer' theme for ListViews & TreeViews on Vista+

Posted: 16 Sep 2017, 15:55
by SKAN
Wonderful selection effect when in lististview's Icon-view.
Thanks for sharing!

Re: 'Explorer' theme for ListViews & TreeViews on Vista+

Posted: 06 Oct 2019, 13:39
by think
Any update on this? As mentioned by Fords, is there a way to remove the grids?

Re: 'Explorer' theme for ListViews & TreeViews on Vista+

Posted: 15 Apr 2021, 22:33
by jly
Can the parameters of SetWindowTheme be set to something other than Explorer?


Execute the following command in powershell, and you will see another style of Listview.
Is it possible to set Listview to that style through AutoHotkey?

Code: Select all

gp 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\*' | select PSChildName, Name | sort Name | out-gridview
Listview_Theme.png
Listview_Theme.png (172.99 KiB) Viewed 4158 times

Re: 'Explorer' theme for ListViews & TreeViews on Vista+

Posted: 17 May 2021, 06:17
by jballi
jly wrote:
15 Apr 2021, 22:33
Can the parameters of SetWindowTheme be set to something other than Explorer?
Very late reply. Sorry 'bout that.

The documentation for theme subclasses is very limited. Just figuring out that they exist and that they can be changed is no simple feat.

Because there so little documentation on the topic, I would guess that the use of theme subclasses (other than the default) is primarily used by Microsoft for Microsoft software. Most of the themes make minor and subtle changes. They offer a consistency for a particular use but they don't provide much value to the average developer. In an attempt to ensure that you won't waste much of your time on this topic and because this was posted in the "Tips and Tricks" forum, I will repeat myself. Most subclass themes don't provide much value to the average developer.

The exception is the "Explorer" theme for the ListView and TreeView controls. This theme offers a very unique and interactive change to the control. I like it because 1) it changes the color of the row as you move the cursor over it and 2) if the row has an icon, it does not change the color of the icon when the row is selected.

To answer your question: Yes, there are theme names other than "Explorer". Each control has a different list of subclass theme names that are available. In addition, you can remove the theme for the control to get a "no theme" theme. I have been unable to find a complete list of theme names but I've found a couple places to get you started. Disclaimer: I have only tested themes for a few of the controls.

Using Theme Subclasses
Tip: You don't need the theme messages anymore. Use the SetWindowTheme system function instead.
https://docs.microsoft.com/en-us/windows/win32/controls/theme-subclasses

Theme Explorer
Tip: The theme names are embedded in the code in the Classes and Subclasses section.
https://github.com/mity/theme-explorer/blob/master/src/db.c

I hope this is helpful.