7+ Taskbar Tweaking Library

7+ Taskbar Tweaking Library is a library for manipulating the taskbar of Windows 7 and above. It’s inspired by the 7+ Taskbar Tweaker program, and it allows you, as a programmer, to manipulate the Windows taskbar, which is virtually impossible to do with the documented Windows API.

You can take a quick look at the provided API here. For a more extensive look, refer to the examples which are provided together with the library.

In general, the library allows you to:

  • Get extensive information about the taskbar items and groups on all taskbars.
  • Reorder taskbar items, and reorder buttons within groups.
  • Set per-AppId settings.

For example, if you’d like to have the taskbar button of your program to never show labels, you can easily do it with the library:

Download

You can get 7+ Taskbar Tweaking Library here:

zip TTLib.zip (399.58 kB)

Please note that the library is free for non-commercial use only. If you’re interested in using the library for a commercial application, please contact me.

Posted in Programming by RaMMicHaeL at October 31st, 2014.
Tags:

69 Responses to “7+ Taskbar Tweaking Library”

  1. staticvoid says:

    Nice work. Thanks 🙂

  2. DebugErr says:

    Don’t know if this is good or not. Many noobish programs will now mess around with the taskbar. Better avoid these.

    • RaMMicHaeL says:

      If you prevent programs from doing stupid things, then you also prevent them from doing clever things. -Raymond

      • DebugErr says:

        Of course. The problem is, there are always black sheep. Ask Microsoft why they removed program access to the pinned start menu item list. Because every stupid program feeling important enough would pin itself there, probably with an uppercase title.
        These programs here will probably override your enjoyed setting of having grouped buttons and will always show their – probably uppercase – title. At least you should add an option to the 7+ taskbar tweaker to ignore such settings if it becomes more and more common that programs mess with _your_ settings.

  3. Javan MIller says:

    Will this be made available to Windows 10 technical preview?

  4. Retired Engineer says:

    Some great ideas are being implemented in 7TT. Contribution is on its way.

  5. Amazing dude!!! your 7+ Taskbar Tweaker is a MUST HAVE!
    I can’t live (using Windows 7 or 8) without it !

    take a look at my software: https://sourceforge.net/projects/clipboardextra/

  6. E.Hatt-Swank says:

    Just wanted to say thank you for creating this very useful tool. I have to use Windows 7 for my job, and regularly have 10-20 Putty sessions open to various servers. The W7 taskbar behavior of shifting icons around randomly is immensely frustrating and a real productivity-killer, because i need the icons to remain open in the order I opened them, so i can hop from one to another quickly. Your tool saved the day. Brilliant!

  7. Rebelane says:

    Hi, Just a grateful thanks and my appreciation.
    Stay Stafe.

  8. KEALHOVIK says:

    Does this version work with Win 10 Anniversary update?

    • RaMMicHaeL says:

      Are you referring to the library, or to the 7+ Taskbar Tweaker program?
      For the former, it doesn’t. It needs to be updated.
      For the latter, there’s a beta version which you can try.

      • KEALHOVIK says:

        Thanks for the answer and amazing software. Gonna wait for updated library

        • RaMMicHaeL says:

          May I ask, what are you using the library for?
          I didn’t get much feedback for the library ever since it was released, and I’m curious to know whether it is being used, and if it is, then what are its uses.

          • KEALHOVIK says:

            I just find this option “cycle between taskbar buttons with mousewheel” after installing beta and running through setup again. I really like it but it’s gonna be more productive to use mousewheel in combine with some hotkey so you don’t need to move your cursor to the taskbar. So i wanted to recreate this function with ahk script using your library. Although i have no experience working with libraries and not much experience in programming actually, but i wanted to create something that would be actually usable.

            • RaMMicHaeL says:

              Sounds interesting, good luck with the project. I have just updated the library. Feel free to contact me if you need any help, and it would be interesting to look at the result when it’s done.

  9. Lkytal says:

    I tried but seems not working on windows10 1607 x64.

    • RaMMicHaeL says:

      What’s not working? Are you seeing an error message? You have to provide more details so I’ll be able to help you.

      • Lkytal says:

        I build example “taskbar_button_manipulator” with vs2013, run it and select “never group” (and other options), no error occurs, output message was successfull, but no effect.

        • RaMMicHaeL says:

          To see the effect of the grouping option, you’ll need to launch more than one instance of the program.
          The “Show labels” option, on the other hand, should work even with one instance.

          Also, make sure that you are compiling for the right architecture (32 or 64-bit).

          If it still doesn’t work, please provide the full output of the console window.

          • Lkytal says:

            I launch two instance of firefox with no effect while your 7+ Taskbar Tweaker program works, have no idea why.
            Running your example generate standard output as below:
            Initializing 7+ Taskbar Tweaking library…
            Loading 7+ Taskbar Tweaking library into explorer…
            Adding AppId to list… Operation succeeded
            Nothing seems go wrong…

            • RaMMicHaeL says:

              The “taskbar_button_manipulator” demo only controls its own buttons. It shouldn’t affect Firefox, or any other program. See the code for more details.

              • Lkytal says:

                I see, so I have to manually get my target’s ApplicationId in order to control it? May I ask how you control the whole taskbar icons, by enum all of it? thx.

                • RaMMicHaeL says:

                  I see, so I have to manually get my target’s ApplicationId in order to control it?

                  Yes.

                  May I ask how you control the whole taskbar icons, by enum all of it? thx.

                  You cannot do that with the library. It was designed to control your own programs, not the global system settings.

                  May I wonder what your goal is?

                  • Lkytal says:

                    I’m trying to implement a extension program to control the behavior of the target program, one of it’s function is to disable the target’s icon combination, is their any solution?

  10. José Rebelo says:

    Is it / would it be possible to move the taskbar buttons handle programatically? (this, right next to Chrome: https://i.imgur.com/KrnsNV3.png, it shows up when the taskbar is unlocked).

    I was wondering if it would be possible to keep the taskbar buttons centered on the screen using it.

  11. Chris_Bognar says:

    Curious to whether the 7TT library has the necessary functions implemented to write a small exe for changing a program’s AppID passed as a command-line parameter. Newly into programming, would like to try this project if the base functions are in the library, because I need both the practice and the functionality. I have rudimentary C++ skill, but am still struggling reading the header declarations. I don’t believe I see any functions that set AppID for Taskbar buttons, but I may be too new to see it.

    • RaMMicHaeL says:

      You don’t need the 7+ Taskbar Tweaking Library change a window’s AppID. Windows provides this functionality.
      There’s actually an implementation of such a function in the file Examples\taskbar_button_manipulator\wnd_set_appid.c in TTLib.zip.

      • Chris_Bognar says:

        You pointed me in the right direction. I was able to read and understand what’s happening in the examples. If I’m not mistaken, you are setting the AppID of the console window to taskbar button manipulator. I didn’t initially see this effect correctly because I was using ConEmu, which was injecting itself as a console wrapper, and when I stopped the ConEmu wrapper, it worked properly.

        Thank you for the quick response, very much appreciated.

  12. Clayton Rupe says:

    Thank you so much! Please continue to keep up the good work!

  13. Alex says:

    Hi,
    Just wanted to check if this library is still working/supported as of Windows 10 1903 update?
    I pulled the content down and can compile after putting TTLib64.dll in the binary folder but am currently unable to run the included examples. Output:

    Initializing 7+ Taskbar Tweaking library…
    Loading 7+ Taskbar Tweaking library into explorer…
    TTLib_LoadIntoExplorer() failed with error 105

    taskbar_button_printer fails with error 135 instead.

    In both cases, explorer then crashes and console exits (interestingly, this also happens to me when rearranging taskbar with 7+ Taskbar Tweaker 5.7 – maybe 1903 broke something?).

    Is there a step I’m missing with running here?
    I was hoping to implement key bindings to ‘Reorder taskbar items’ by moving a taskbar item to the left/right, which was the only thing feature I felt was missing from your 7+ Taskbar Tweaker.

    Thanks in advance and thanks for releasing this library.

    • RaMMicHaeL says:

      Hi Alex,

      The latest version of the library is v5.6.0.1. The library shares code with 7+ Taskbar Tweaker, and you can deduce the supported Windows versions from the tweaker’s changelog. Currently, Windows 10 October 2018 Update is the latest supported version by the 7+ Taskbar Tweaking Library. I’d need to update it to v5.7 to be in sync with the tweaker and support Windows 10 May 2019 Update. I’ll try to do that in the following days once I find some spare time.

      • Alex says:

        Thanks for the prompt response and the helpful answer, I’ll definitely look forward when the library is updated to 5.7!
        Cheers.

        • RaMMicHaeL says:

          Hi again,

          I’ve updated the library to 5.7 🙂

          • Alex says:

            Hi again RaMMichael,

            I’ve been using the library for the last couple months to reorder taskbar and it works a treat for single taskbar usecase (Thanks again)!

            However, I am running into issues in multi-monitor situations, particularly operating on the handle returned by TTLib_GetSecondaryTaskbar. The program seems to crash when trying to call anything on the second taskbar (even the taskbar_content_printer example crashes when trying to print secondary taskbar). Could this be a bug in the updated dll?

            Second, there isn’t an api available in the library for Set active Button/ButtonGroup which would be useful for my usecase of creating keybindings to manipulate the taskbar. I see there’s a place for feature requests for the main Taskbar Tweaker tool, but not this library – where’s the best place to request/gauge the effort required to expose this functionality to the library?

            I’ve already found the library really useful so far and am super grateful for its existence – looking forward to any response.

            • RaMMicHaeL says:

              Hi Alex,

              I’ve been using the library for the last couple months

              Interesting. Have you considered releasing the source code? It would be interesting looking at code using the library. For now there’s only Virtuoz.

              The program seems to crash when trying to call anything on the second taskbar

              I’ve just updated the library to v5.8. Look at the tweaker’s changelog, perhaps you’re using a Windows version which is no longer compatible with v5.7.

              there isn’t an api available in the library for Set active Button/ButtonGroup

              If I understand correctly, you can just grab the window handle and make it the foreground window with a function such as SetForegroundWindow.

              • Alex says:

                Thanks for the reply!

                Have you considered releasing the source code?

                I held back on putting it anywhere earlier because of the limitation of only reordering groups on the main taskbar, but what’s working so far is here.

                perhaps you’re using a Windows version which is no longer compatible with v5.7

                I’m still running 1903 so wouldn’t think that’s the case but I tried the updated library, thanks for the heads up! Unfortunately the same issue is still happening on a laptop attached to external monitor.

                The symptom is mouse movements slowing to a crawl, then behaviour that’s similar to restarting explorer.exe or trying to drag a ButtonGroup by mouse while debugger is attached to the taskbar modifying code.

                The actual .exe using TTLib.dll stays open this time and just hangs at the point where you tried to call an api on secondary taskbar. I’ve attached a screenshot for taskbar_contents_printer.exe trying to call TTLib_GetTaskbarMonitor(hTaskbar)) after getting the window handle here. This is taken right after the taskbar ‘restart’ is observed (it eventually repopulates with all the ButtonGroups) – any pointers on how to proceed from here (do I need to update to 1909)?

                you can just grab the window handle and make it the foreground window with a function such as SetForegroundWindow.

                Appreciate the advice, still new to poking around in Win32 land – I’ll give that a shot too.

                • RaMMicHaeL says:

                  I can reproduce the crash in a multimonitor environment. I’ll look at it in the next couple of days once I have some spare time.

                • RaMMicHaeL says:

                  I found and fixed the issue. It affected Windows 10 Anniversary Update (released three years ago) and newer. Apparently the library is not used enough 🙂

                  • Alex says:

                    Hi RaMMichaeL,

                    Your previous fix worked great on 1909!

                    Looks like the library’s broken again with the new Windows 2004 update though, just tried to update and rebuild with the v5.8.0.1 library in TTLib.zip and no joy – It appears the same issue in my previous messages is happening again.

                    I know 2004 has only recently released mainline (I honestly should have checked compatibility before upgrading) so happy to patiently await updates on the tweaking library if any – perhaps I’m one of few users for the library but I definitely do rely on it!

                    Thanks again.

  14. Alex says:

    Looks like it works a charm now – thanks for the quick turnaround!

  15. Hortiks says:

    Thanks a lot for this usefull application, can’t use my navigator without it now 🙂
    I would just know if you use a service to start the app and if i can delay it ?

    • RaMMicHaeL says:

      You’re commenting under the 7+ Taskbar Tweaking Library page, but you’re probably referring to the 7+ Taskbar Tweaker tool. It doesn’t use a service, the startup is set in the registry. There’s no built-in way to delay the startup, but you might be able to use a third party tool or a custom solution (such as a script) for that.

  16. Jerry Ho says:

    Damn, I was like, searching for MSTaskListWClass for a whole night, and then nothing. Undocumented.

    Thought I’ll have to hook windows dll ultimately…..until I stumbled upon your work.

    This is so fucking great.

    Thank you very very much!

    One quick question:
    Regarding DwmQueryThumbnail, it seems that I cannot directly save them into files, there’s no way to transfer it outside the view.

    This is the thumbnail you can see by pressing win+tab.

    I wonder if you have any idea on how to save realtime process thumbnails generated by OS? (this is just what DwmThumbnail provided.)

  17. Mark says:

    Hi, thanks so much for 7TT, it’s so useful for me in my day to day development work. Just a quick question about the library, how often does it get updated to match the most recent 7TT version? And is it always available up-to-date at the link on this page? I can’t get the current version to load into the explorer process (either from my own code, or the sample projects). I’ve also tried running it as an administrator, I still always get the same error, ERROR_ACCESS_DENIED.

    Thanks!

    • RaMMicHaeL says:

      Hi Mark,
      Thanks for the feedback, I’m glad that you like the tweaker.
      Regarding the library, it’s not updated as often as the tweaker. Because I don’t use it myself, I only update it when people ask about it. And it doesn’t happen very often, so it looks like not many use it.
      May I ask about your usage of the library? Just curious.

      • Mark says:

        I have a tool that I use to do custom jump lists on the taskbar, mostly for stuff like custom terminal setups or making a set of related programs easy to start and group together, and I thought I might be able to use TTLib to help with grabbing AUMIDs for non-UWP programs that don’t set a manual id (most don’t return anything from GetApplicationUserModelId, and they don’t have anything in the window property store)

  18. Artur says:

    Hi, thanks a lot for this awesome library.
    I have one problem though. It seems to be impossible to use this library simultaneously by two applications. The second one fails to load into Explorer.
    Do you think it’s possible for you to fix it?

    • RaMMicHaeL says:

      One workaround is to make each application load a different copy of the library. e.g. have app_1.exe load TTLib_1.dll, and have app_2.exe load TTLib_2.dll.

      Having two apps using the same library file is explicitly disallowed at the moment. It might be possible to allow that by managing the library lifetime properly.

      • Artur says:

        One workaround is to make each application load a different copy of the library. e.g. have app_1.exe load TTLib_1.dll, and have app_2.exe load TTLib_2.dll.

        Yes, I have noticed that and it does help somewhat. But it’s unfortunately not really a solution when I want to run two instances of the same executable, because they will always implicitly link to the same dll file. The only workaround I can imagine would be to make a temporary copy of the dll and link to it explicitly and that is just ugly and I’m not sure would even work in the first place.

        What I wonder though is why does this limitation exist in the first place. How does it matter whether you have two separate files or one? Doesn’t Windows still always hold a single copy of the dll in the memory anyways?
        Maybe I’m misunderstanding something or maybe is it the fact that that the library has to inject some code into Explorer? But then why does it work when there are two separate dll files on the disc and doesn’t when there’s only one?

        • RaMMicHaeL says:

          The only workaround I can imagine would be to make a temporary copy of the dll and link to it explicitly and that is just ugly and I’m not sure would even work in the first place.

          That’s possible, but it’s a bit ugly, I agree. Alternatively, depending on your program, you can make it so that only one process instance manages the functionality. Or split it to a single process that uses the library, and multiple processes that communicate with it.

          why does this limitation exist in the first place

          Because supporting multiple processes using the same library wasn’t implemented, because until now there was no need for it.
          Here’s the current architecture: https://i.imgur.com/zq7vuyx.png

          How does it matter whether you have two separate files or one? Doesn’t Windows still always hold a single copy of the dll in the memory anyways?

          Windows holds a single copy of a dll only as long as it resides in the same file, having the same path. If there are two dll files which are the same, but reside in different files, Windows doesn’t compare them to see whether they’re equal.

          But then why does it work when there are two separate dll files on the disc and doesn’t when there’s only one?

          Maybe the image above will help you understand why. With two separate dll files, two instances are loaded into explorer, each managing its own state and communicating with its process.

          • Artur says:

            Thanks for the explanation. It’s all clear now. What confused me was that I thought Windows is smarter than that and always holds one instance, even if there are separate copies in different directories.

            BTW I’ve seen you’ve opened sourced most of the Tweaker code. Have you considered doing the same with this library? It would be fun to have a look.

            • RaMMicHaeL says:

              Have you considered doing the same with this library? It would be fun to have a look.

              No. You’re the first one asking about it, and the interesting bits are in 7+ Taskbar Tweaker anyway. I can consider releasing it, but it merely adds standard inter-process communication to what’s already released at the tweaker’s repository.

              May I wonder what’s your usage of the library? Just curious.

              • Artur says:

                You’re the first one asking about it, and the interesting bits are in 7+ Taskbar Tweaker anyway. I can consider releasing it, but it merely adds standard inter-process communication

                May be, but I’ve hoped that the library, being much narrower in scope and focused on doing just the few things it does, would be somewhat easier to comprehend than the whole complexity of the Tweaker.

                May I wonder what’s your usage of the library? Just curious.

                The way I typically work I tend to have many browser windows opened simultaneously. And I like to have them arranged in a particular order. Thanks to your Tweaker I can reorder them with no issue. But the problem comes when I restart my browser, which often times is necessary, for example due to updates. And while I can easily restore the session and all the windows I had before, they come up with the wrong order and I have to manually fix that every time. And that gets annoying really fast.
                So I wrote a simple browser extension which monitors the arrangement of my windows and allows to restore their order with a single click after the browser restart. I even recently released that on my github (https://github.com/pragacz/window-arranger-webext), although the use case is quite niche, so I don’t expect it’ll be that useful to anyone else.

  19. Artur says:

    Unfortunately it’s not that simple. The way WebExtensions work is that all you can give to the browser is the path to the executable with which you wish your extension to communicate. It is then the browser’s responsibility to start that process and facilitate its communication with your extension. I imagine it was designed that way due to security considerations.

    And it all works great until you decide to start more than one Firefox instance at the same time. Which you might reasonably want to do sometimes, if for example you’re using more than one Firefox profile. And then 2 Firefox instances = 2 instances of the extension = 2 instances of the native process started by them = your library gets run 2nd time and crashes.

    And so, given the above limitations, the only proper solution I see to develop on my side would be to:
    1. split my code into 2 separate executables – a client and a server
    2. provide a way for the client to detect if the server is running and if not, start it
    3. code some proper IPC between the two
    4. make sure the server works with multiple clients connected to it
    5. close the server when the last client quits

    Now, I haven’t seen your code so I can’t know for sure, but I’d imagine it’d be significantly easier to make it multi-process compatible there instead of all the above. But that’s really up to you to decide.

    • RaMMicHaeL says:

      I’d imagine it’d be significantly easier to make it multi-process compatible there instead of all the above.

      I’m not sure that it’s going to be significantly easier. The library acts both as a client and as a server, depending on which code is executed, and the server side (running from the context of explorer) is designed to support a single client, including the IPC itself and other measures baked into the code, such as if the client is killed then the DLL is unloaded automatically. One quick solution you can use is calling TTLib_LoadIntoExplorer and TTLib_UnloadFromExplorer on each operation, guarded by a shared mutex to avoid collision. I’m not sure how it’s going to affect performance, though.

      Regarding “significantly easier”, since the library is written in low level C, and you have more freedom in choosing a high level language and IPC facility, I believe that you can come up with a solution which can be rather simple if you choose that route.

      • Artur says:

        Ok, thanks for the above explanation. As I said it’s kind of hard to discuss the code I haven’t seen.

        After some consideration I think the most straightforward way to solve this is to simply make the copy of the dll and circumvent the limitation that way. Easy and reliable and shouldn’t make any problems.

        The only question left is where to do this. I can do this on my side, but you can also make the temp copy before injecting into the Explorer and retain the one to one mapping that way, since only that creates problems as far as I understand. The benefit is that it would work for the other users of the library as well.

        Let me know if you’re willing to make that kind of change. If not, then I’ll make that on my side only and call it a day.

        • RaMMicHaeL says:

          As I said it’s kind of hard to discuss the code I haven’t seen.

          I see that you mention it again and again. If you’d like to discuss it, here are some of the “entry point” parts of the library: https://gist.github.com/m417z/d523a5a1c8d71d74152aa4c5837a163f Hopefully that’s enough to understand how it works in general. The Init function is what’s running in the context of the explorer process. The rest of the code (which is not included in the Gist) is very similar to the code of the tweaker, with removed functionality.

          you can also make the temp copy before injecting into the Explorer

          I prefer not to do that, since it’s not necessary for most users, I believe, which are OK with running only a single instance of their program that uses the library.

          • Artur says:

            here are some of the “entry point” parts of the library

            I’ll take a look when I have some spare time. Thanks for taking the time to post this.

            I prefer not to do that, since it’s not necessary for most users, I believe, which are OK with running only a single instance of their program that uses the library.

            Understandable. I’ll implement what I need myself then.

            Thanks again for the discussion here and for your great Tweaker and the library.

Leave a Reply to Alex