'Explorer' theme for ListViews & TreeViews on Vista+

Put simple Tips and Tricks that are not entire Tutorials in this forum
just me
Posts: 9424
Joined: 02 Oct 2013, 08:51
Location: Germany

'Explorer' theme for ListViews & TreeViews on Vista+

Post by just me » 16 Jul 2015, 03:01

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
}

tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

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

Post by tmplinshi » 16 Jul 2015, 04:07

Nice!

tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

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

Post by tmplinshi » 17 Jul 2015, 03:58

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
}

Fords

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

Post by Fords » 14 Aug 2017, 04:50

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

User avatar
SKAN
Posts: 1551
Joined: 29 Sep 2013, 16:58

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

Post by SKAN » 16 Sep 2017, 15:55

Wonderful selection effect when in lististview's Icon-view.
Thanks for sharing!
My Scripts and Functions: V1  V2

think
Posts: 136
Joined: 09 Feb 2014, 05:20

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

Post by think » 06 Oct 2019, 13:39

Any update on this? As mentioned by Fords, is there a way to remove the grids?

jly
Posts: 89
Joined: 30 Sep 2020, 06:06

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

Post by jly » 15 Apr 2021, 22:33

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 3996 times

User avatar
jballi
Posts: 723
Joined: 29 Sep 2013, 17:34

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

Post by jballi » 17 May 2021, 06:17

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.

Post Reply

Return to “Tips and Tricks (v1)”