[class][v1/v2] taskbar ornaments and controls

Post your working scripts, libraries and tools
Helgef
Posts: 1894
Joined: 17 Jul 2016, 01:02
Contact:

[class][v1/v2] taskbar ornaments and controls

02 Aug 2017, 09:01

Introduction
This class implements some of the taskbar extensions discussed here (msdn).
For a full introduction and documentation, please visit the github wiki.
There are two versions available, one for (recent) AHK v1.1 and one for AHK v2 (2.0-a081-cad307c). The version for v2 is cleverly named taskbarInterface_v2.ahk

Graphical preview - a selection
Image
Button controls in the thumbnail preview window, the thumbnail preview is clipped to only show a listbox of the gui.
Image
Progress bar and icon overlay.

Download
Source and self-contained examples are available at github. Direct download: v1.02_with_examples.rar.
Mini tutorial

To highlight the ease of use. I give a mini tutorial.

Part 1 - show an icon overlay.
Image
Code



Part 2 - show a progress bar behind the taskbar icon.
Image
Code



Part 3 - Add two buttons to the thumbnail preview.
Image
Code


Real use example
Please try out wolf_II's nice app Anagrams (v2.13+), for a real use example of this class.

Misc
Feel free to use this in whichever modified or non-modified state you wish, for any peaceful purpose. No credits or references needed.

Have fun and good luck :wave:
Last edited by Helgef on 13 Aug 2017, 03:37, edited 3 times in total.
TheDewd
Posts: 711
Joined: 19 Dec 2013, 11:16
Location: USA

Re: [class][v1/v2] taskbar ornaments and controls

02 Aug 2017, 09:46

This is crazy good! Thanks for sharing! Does it work with Windows 10?
Helgef
Posts: 1894
Joined: 17 Jul 2016, 01:02
Contact:

Re: [class][v1/v2] taskbar ornaments and controls

02 Aug 2017, 09:55

Thanks. I have tested it only briefly on win 10 and saw no problems. All development is done on win7 though. However, I have seen nothing in the documentation of the used apis, suggesting there would be any compabillity issues with win10.
Last edited by Helgef on 03 Aug 2017, 02:36, edited 1 time in total.
wolf_II
Posts: 1487
Joined: 08 Feb 2015, 20:55

Re: [class][v1/v2] taskbar ornaments and controls

02 Aug 2017, 15:55

Thank you for sharing this class. I really love it. :clap: :thumbup:



I have posted an update to Anagrams that includes credit and link to here.
User avatar
Delta Pythagorean
Posts: 128
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the 8th Dimension I think...

Re: [class][v1/v2] taskbar ornaments and controls

02 Aug 2017, 18:35

This is actually quite impressive! I think I'll implement this into some of my programs for later use!

Code: [Select all]GeSHi © Codebox Plus

vDelPy := RegExReplace("Delta Pythagorean", "^(\w{3})\w*\s+\b(\w{2})\w*$", "v$1 $2")

Need help with anything? Send me a message! It's likely I've ran into your problem before.
User avatar
joedf
Posts: 5662
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: [class][v1/v2] taskbar ornaments and controls

02 Aug 2017, 21:57

Holy moly, nice! :D
Helgef
Posts: 1894
Joined: 17 Jul 2016, 01:02
Contact:

Re: [class][v1/v2] taskbar ornaments and controls

03 Aug 2017, 03:58

Thanks for your kind words.

I have added a mini tutorial to the first post. To give a quick insight on how to use this.

Cheers.
User avatar
boiler
Posts: 1695
Joined: 21 Dec 2014, 02:44

Re: [class][v1/v2] taskbar ornaments and controls

03 Aug 2017, 09:23

Very nice work. Will be quite useful. Thank you for sharing this with us.
gwarble
Posts: 194
Joined: 30 Sep 2013, 15:01

Re: [class][v1/v2] taskbar ornaments and controls

04 Aug 2017, 15:50

very nice, thanks for sharing
EitherMouse - Multiple mice, individual settings . . . . www.EitherMouse.com . . . . forum . . . .
User avatar
jeeswg
Posts: 1700
Joined: 19 Dec 2016, 01:58
Location: UK

Re: [class][v1/v2] taskbar ornaments and controls

10 Aug 2017, 13:59

@Helgef: many thanks for this.

I would be interested to know if some of these methods can be applied to external taskbar buttons. The main problem is how to get a pointer to the interface. [EDIT:] This can be done simply by using ComObjCreate as shown in the DllCall example below.

[EDIT:] These links were useful, especially the DllCall one:
[advanced] Using raw COM interfaces in AHK - Tutorials - AutoHotkey Community
https://autohotkey.com/board/topic/81077-advanced-using-raw-com-interfaces-in-ahk/
[AHK_L + AHK v2] COM Classes Framework (CCF) - Scripts and Functions - AutoHotkey Community
https://autohotkey.com/board/topic/66205-ahk-l-ahk-v2-com-classes-framework-ccf/
interfaces · maul-esel/COM-Classes Wiki · GitHub
https://github.com/maul-esel/COM-Classes/wiki/interfaces
GitHub - maul-esel/COM-Classes: AHK classes that implement COM interfaces
https://github.com/maul-esel/COM-Classes
[the final example here relates to taskbar buttons:]
DllCall
https://autohotkey.com/docs/commands/DllCall.htm

[EDIT:] After reading up on everything, I wrote an example that shows how to change the colour of taskbar buttons for any window (red/yellow/green):
Distinguishing Between Multiple Windows of Same Application - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=35670&p=164288#p164288

==================================================

To create the object and to make the taskbar button change colour like a progress bar see the 'initInterface' and 'setProgress' functions:
taskbarInterface/taskbarInterface.ahk at master · HelgeffegleH/taskbarInterface · GitHub
https://github.com/HelgeffegleH/taskbarInterface/blob/master/taskbarInterface.ahk

Also see:
ITaskbarList interface (Windows)
https://msdn.microsoft.com/en-us/library/windows/desktop/bb774652(v=vs.85).aspx
ITaskbarList3 interface (Windows)
https://msdn.microsoft.com/en-us/library/windows/desktop/dd391692(v=vs.85).aspx
Last edited by jeeswg on 10 Aug 2017, 16:48, edited 2 times in total.
Helgef
Posts: 1894
Joined: 17 Jul 2016, 01:02
Contact:

Re: [class][v1/v2] taskbar ornaments and controls

10 Aug 2017, 16:15

@boiler and gwarble, cheers!

Hello jeeswg :wave:
Regarding applying to external taskbar buttons, I assume you mean buttons belonging to windows not owned by your application. I did write in the documentation that the window must belong to the application, I took that from memory :D I'm somewhat certain I read it somewhere. Your example suggests that at least the progress method can be applied to unowned windows, nice! But keep in mind, whenever the button is destroyed, eg when the window is hidden and then shown again, you need to re-apply the progess. My implementation handles that, but not for windows which doesn't belong to the script.

The main problem is how to get a pointer to the interface.

I'm not certain what you mean.

Cheers.
rommmcek
Posts: 232
Joined: 15 Aug 2014, 15:18

Re: [class][v1/v2] taskbar ornaments and controls

12 Aug 2017, 10:07

Very impressive! Helgef for Administrator!
Btw: Showing Icon image in the thumbnail seems to be Dpi depended. I'm using Gui, new, hwndhWnd -DPIScale.
Attachments
Dpi dependencies.png
Dpi dependencies.png (16.81 KiB) Viewed 220 times
Helgef
Posts: 1894
Joined: 17 Jul 2016, 01:02
Contact:

Re: [class][v1/v2] taskbar ornaments and controls

13 Aug 2017, 03:34

Hello rommmcek.
Good observeration! In a non-example context, one should probably not hardcode the clip coordinates, but rather scale them using A_ScreenDPI, or as you suggest, use -DPIScale. I made a note in the documentation.

@ jeeswg. I saw your edit, which relates to my uncertainty. Note that the when I use the word interface I mean the explicit graphical connection link between the user and the taskbar. taskbarInterface.ahk is not an implementation of the ITaskbarList abstract (data type / class template) interface, it is (partly) a wrapper around window's implementation of that abstract interface.
From your link, ITaskbarList3
Remarks wrote:When to Implement
An implementation of this interface is provided in Windows as CLSID_TaskbarList. This interface is not implemented by third parties.

Cheers.
User avatar
jeeswg
Posts: 1700
Joined: 19 Dec 2016, 01:58
Location: UK

Re: [class][v1/v2] taskbar ornaments and controls

15 Aug 2017, 23:55

I was interested in whether ITaskbarList/2/3/4 could be used to list all the windows with taskbar buttons. AFAIK there is not a method to do this.

I had hoped that if you tried some of the ITaskbarList/ITaskbarList3 methods using hWnds (e.g. all visible windows retrieved via WinGet) that did/didn't have a taskbar button, the return value, success/failure, would give you a way to determine which hWnds had taskbar buttons and which didn't. Unfortunately the methods I tested appeared to return 0 every time, whether the window had a taskbar button or not.

Anyhow, I mention this in case I missed something, and the approach could be made to work somehow, or if anyone has an alternative approach other than checking window styles/extended styles. Cheers.
Helgef
Posts: 1894
Joined: 17 Jul 2016, 01:02
Contact:

Re: [class][v1/v2] taskbar ornaments and controls

17 Aug 2017, 13:02

jeeswg, you could check if the functions set A_LastError on failure, I do not remember.

if anyone has an alternative approach other than checking window styles/extended styles

Can you do it by style?

Cheers.
User avatar
jeeswg
Posts: 1700
Joined: 19 Dec 2016, 01:58
Location: UK

Re: [class][v1/v2] taskbar ornaments and controls

17 Aug 2017, 13:42

Thanks Helgef, A_LastError is a good suggestion but it didn't appear to work.

I've tried adding/removing a tab, and getting the window style/ExStyle before/after, (see the code,) but it didn't show any difference.

I've posted my code, in case I've missed something:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



[EDIT:] Btw I was curious as to whether some of the techniques in the script could be used to invoke (open) a specific Internet Explorer tab (or list the tabs, although listing the tabs can be done via COM).

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 12 guests