6

My program needs to open a series of information windows when requested by a user, and would like to implement some kind of custom grouping on the windows 7 taskbar.

Desired functionality: All of my information windows should be grouped together (if grouping is enabled on the users system, that is) but my main window should NOT be grouped with the information windows.

I can not spawn a new process for my information windows.

My thought process is that there could be a way to modify the window handle of the information window somehow to get the taskbar to group it separately but I honestly don't even know where to start with this.

EDIT

Ive found some new information. I may be able to do something with SHGetPropertyStoreForWindow as stated here: http://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx#where

...As a property of any of the application's running windows. This can be set in one of two ways: If different windows owned by one process require different AppUserModelIDs to control taskbar grouping, use SHGetPropertyStoreForWindow to retrieve the window's property store and set the AppUserModelID as a window property.

caesay
  • 16,932
  • 15
  • 95
  • 160

2 Answers2

2

Application User Model IDs says:

"If different windows owned by one process require different AppUserModelIDs to control taskbar grouping, use SHGetPropertyStoreForWindow to retrieve the window's property store and set the AppUserModelID as a window property."

Harry Johnston
  • 35,639
  • 6
  • 68
  • 158
  • This worked for me. I couldn't use the Windows API Code Pack as we're a .NET 2.0 app. – user326608 Feb 14 '13 at 17:44
  • 1
    My problem was that our app can also be launched via COM, and when it was it would always combine in the taskbar grouping and use the same icon and taskbar button as the parent app that was calling the child app via COM. This is the VB.NET code that did the trick: `Public Declare Function SetCurrentProcessExplicitAppUserModelID Lib "Shell32.dll" Alias "SetCurrentProcessExplicitAppUserModelID" ( ByVal AppID As String) As Integer)` `SetCurrentProcessExplicitAppUserModelID("CompanyName.ProductName.SubProduct.1.0.0.0")` – user326608 Feb 14 '13 at 17:50
0

I solved it by using the Windows API Code Pack for .NET and the following code:

TaskbarManager.Instance.SetApplicationIdForSpecificWindow(window, guid);

Window assigned with the same id will be grouped together - windows with a unique id will have a separate taskbar icon.

caesay
  • 16,932
  • 15
  • 95
  • 160
  • How to get window handle and what (gu)id is this? – Brackets Aug 26 '17 at 16:05
  • @Brackets : you can use any guid. Windows with the same guid will be grouped together - windows with a unique id will have a separate taskbar icon. – caesay Aug 28 '17 at 00:20