What if I have two programs that are logically a single application, and I want them to be treated as a single group on the taskbar?

Suppose you have two programs that are logically one application, and you want them to be treated as a single group on the taskbar, share jump lists, and all that stuff. Basically, even though they are physically separate executables, they should be logically be treated as two facets of the same application.

This the opposite of What if my application is really two applications bundled into a single file, and I want them collected into two groups on the taskbar in Windows 7?. But the solution is the same.

As noted in the linked article, the central concept is the Application User Model ID. The shell uses the Application User Model ID to identify applications. If you give two processes the same Application User Model ID, then they will be treated as two instances of the same application. If you give them different Application User Model IDs, then they will be treated as instances of separate applications.

In the linked article, we had two processes running from the same executable, but we wanted them to be treated as separate applications, so we gave them different Application User Model IDs. Today, we have two processes running from separate executables, but we want them to be treated as the same application. Solution: Give them the same Application User Model ID.

Start with our scratch program and make these changes:

Tricked you! We're not changing anything. Just compile and run it. Then copy scratch.exe to scratch2.exe and run that. Observe that the two windows are not grouped together in the taskbar.

Okay, now let's make these changes:

#include <shlobj.h>

int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hinstPrev,
                   LPSTR lpCmdLine, int nShowCmd)

Compile and run this program, then copy scratch.exe to scratch2.exe and run the second copy. This time, the two windows are grouped together because they have the same Application User Model ID.

Bonus chatter: If you create a shortcut to the application, you should also assign the custom Application User Model ID to the shortcut. That way, if the user calls up the jump list for the shortcut, they get the jump list for the correct Application User Model ID.

Comments (29)
  1. Martin says:

    Is it possible to completely disable grouping of the taskbar buttons? I mean following: I run (in this order) calc, notepad and another calc. I will get the first 2 buttons for calc and the third button for notepad. I would like to have the first button for calc, the second button for notepad and the third button for the second calc. Just like it worked in Win XP.

  2. Chris Crowther @ Work says:

    Martin: You can do it in "Taskbar and Start Menu".  Right click on the taskbar and select properties, then change "Taskbar buttons" to "Never Combine".

  3. NotThisMind says:

    @Martin that's a good question, although i'm already used to it. i dislike the all-one button with different windows pop'ing up to choose one which is default…

  4. Burov Dmitry says:

    Does it mean i can now make my own rogue app that would "integrate" it's window into some vastly used app's TaskBar button and trick user to think he works in his, for example, browser or mailer, when he would enter hi password into my program's dialog instead ?

  5. skSdnW says:

    @Martin: No, sadly not. The Explorer team somehow thinks it always makes sense to group things by process/AppModelId even though two Notepad instances might be completely unrelated (or often in my case, related to the other app I started before/after Notepad). In Win10 virtual desktops helps a bit but I'd still like the ability to never group or combine anything.

    You can go around hoping MS will hear you or just use rammichael.com/7-taskbar-tweaker

  6. skSdnW says:

    If anyone wants to group different programs on XP/Vista then you have to add a undocumented TaskbarExceptionsIcons registry key…

  7. Henke37 says:

    Was there not an article on this some years ago? But I think it used some GUIDs. Also some sort of OEM tie in?

  8. Max says:

    @Burov Dmitry: Only if you have a way to get the Application User Model ID from an existing program! And you'd probably have to be able to do it on the fly, given most that programs don't specify one – it's an optional property, and if it's not set, then the system will dynamically generate one.

    Also, it's a documented feature and has been for quite some time, so if it were easy to exploit then it'd be done quite regularly by now.

  9. Koro says:

    Also, if you can have your program running on the user's computer already, no need for tricky stuff like that, just go grab that password directly.

  10. DWalker says:

    @skSdnW (with the rude handle): "I'd still like the ability to never group or combine anything."  

    As was already mentioned in these comments, the ability to do what you want is ALREADY there.

    TaskbarTweaker is mostly just a different interface into what is already provided.  Just right-click on the Start button and select Properties.

  11. skSdnW says:

    @DWalker: Read the first comment by Martin and try his experiment. No matter what taskbar settings you choose (including "never combine"), you will always end up with calc,calc,notepad even if you start them as calc,notepad,calc.

    I believe TaskbarTweak injects a .dll into Explorer and hooks several functions and/or changes AppModelId's on the fly to remove the grouping.

  12. meh says:

    Hah. Poor Martin probably never thought he'd generate a rehash of this old chestnut of a discussion about taskbar button groupings. sksdnW's 9:03AM comment about the way the Windows 7 "never combine" setting works is correct, by the way. Slightly annoying that I couldn't lay out task bar buttons the way I wanted when I first undid combining/grouping back in 2009 or whatever, but I'm over it now.

    @Koro, regarding getting passwords: I suppose a rogue program could enumerate/read from that user's credential vault, but how could it directly grab passwords for other things like their gmail account, etc? Well by enumerating windows / reading other process memory / and grabbing insecure text data, hooking keystrokes, etc… Ok – you're probably right.


    Is it possible to add the Application User Model ID to a shortcut using Active Scripting technologies, for example to a JScript object generated by calling `WScript.CreateObject("WScript.Shell").CreateShortcut("sample.lnk");'?

  14. McBucket says:

    Ok, since some folks are being so snaggly about this, Martin asked, initially, for the ability to stop combining taskbar items ("Is it possible to completely disable grouping of the taskbar buttons?"). As pointed out by a couple of people, the Taskbar Properties "Never combine" setting does exactly that.

    However, Martin further went on to describe a wish to have the uncombined taskbar buttons be ordered, presumably according to the order of their launch. Apparently there's no way to do this using Windows-provided UI, though there may be using some 3rd-party tool.

    So 50% fulfillment of the request already exists: Uncombining separate instances, yes. Ordering on the taskbar, no. You all are free to speculate on why ordering via other than App User Model ID is not offered, not that complaining here will do you much good…

  15. DWalker says:

    The way @sksdnW describes it, with two unrelated Notepad instances being combined, is how Windows works *by default* until you click a couple of times and tell Windows not to do that.  

    I don't understand his comment that "I'd still like the ability to never group or combine anything".  He HAS that ability.  Still, I suppose we don't need to beat this to death.  I just don't like it when people gripe about things being broken that are actually "user changeable".

  16. Jim Buck says:

    7+ Taskbar Tweaker does what's being desired in this thread (and MUCH more). One other feature that I long wished Windows had, and this tweaker tool provides, the ability to drag around the taskbar buttons to reorder them whenever you want.

  17. skSdnW says:

    @DWalker: The way Windows worked by default from 95 to 2000 was no grouping at all and all windows/taskbar buttons are in the order they were created.

    In XP and Vista grouping (when there are many windows of the same type open) is on by default but can be fully disabled.

    In 7,8,10 I have found no way to turn off grouping. The "never combine" option in the taskbar properties tells the taskbar to always create one taskbar button per window but it still groups all those buttons together based on process/AppModelId: http://www.stooorage.com/…/18439753_grouping.png If you try to move one of the taskbar buttons you will see that they move as a group.

    If you know a way around this that is supposedly so simple, please share…

  18. David Totzke says:

    Off Topic – All of the links to James Mickens articles are broken and I can't find him on the MS site anywhere.  Can you provide any insight? At the very least thought I would give you a heads up on the broken links.

  19. James says:

    @DWalker: Did you read the first comment?  It very specifically asks for "I would like to have the first button for calc, the second button for notepad and the third button for the second calc." Visually this would appear as:

    [Calculator] [Notepad] [Calculator]

    That is not currently possible.  Modern Windows with "never combine" enabled instead does:

    [Calculator | Calculator] [Notepad]

  20. Marek says:

    @Burov Dmitry: you can inject your DLL into another process, allocate memory, launch a thread to execute the "change user model id" stuff Raymond described.

  21. Joshua says:

    I gave up trying to fix this kind of thing when the documentation was so bad I couldn't figure out how to set any of this w/o importing some 10mb non-Windows library. I was doing this in .NET, not C++, so the #include that lead to a one-liner didn't work (gobs of inline functions that call functions that I was unable to find the docs for–come on they've got to be documented somewhere but I could not find any of them).

  22. VolatileChar says:

    I'd like the opposite of this (as an end user) for a particular application: For e.g., I normally have two Oultook windows open, one showing the default email view and the other showing the Calendar view. I have a shortcut that I've pinned to the Taskbar to be able to launch Outlook Calendar directly. However, Windows merges it with the main Oultook icon. Is there a way to prevent that?

  23. meh says:

    @David Totzke. Google indicates he has become a professor at Harvard. And his Microsoft Research pages do appear to be down. One rather funny thing I found is that you can do a search on the Microsft Research site for its people and then sort the search by "Most Popular". (Intentionally misinterpreting the result to mean a social interpretation of "most popular".) According to the sort, Bill Buxton is Ace Cool, and one can look for oneself to see who sits last at number 733 and therefore must receive the most atomic wedgies. research.microsoft.com/…/default.aspx

  24. Neil says:

    Also starting from XP the order changes when an application stops responding which is really annoying when you're working on a slow PC.

  25. Pear says:

    Could you please fix the main page of your blog to be browsable by an iphone?

    [I tried; see the custom style sheet at line 240. I don't have an iPhone so I'm flying blind. (Works on my Windows Phone, for all that matters to you.) -Raymond]
  26. DWalker says:

    OK, I get it, some people want to control the ORDERING of taskbar buttons or let them be ordered on the taskbar in the order they were opened.  Sks used the word "Grouping" and said "it still groups all those buttons together" when he meant they are ordered together (they are not grouped in the Taskbar-button grouping sense), so I didn't follow what he meant.  

  27. Rick C says:

    @sksdnW, thanks for not putting your image on imgur or something like a normal person.  I really appreciated getting that porn ad on my work computer.

    (lest anyone think I'm exaggerating, I'm not.  I'll spare you all a description of the ad, but suffice it to say it was full-on explicit.)

  28. skSdnW says:

    @DWalker: OK, maybe button cluster then? If you drag it all the buttons in that cluster/group still act as one button.

    @RickC: Imgur upload was broken (not sure if it was related to Camp Imgur) and I block ads so I didn't know that site was bad, it was listed on imgops.com. Here is another copy http://i.imgur.com/mN8YiqZ.png

  29. Rick C says:

    @skSdnW  Thanks for the better upload.  My company doesn't monitor our Internet usage but I'd imagine someone whose company does could get in trouble.

    Perhaps Raymond could edit your first comment to use the imgur URL?

Comments are closed.

Skip to main content