控制我的应用程序的windows 7任务栏分组

时间:2021-02-24 07:25:48

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.

我的程序需要在用户请求时打开一系列的信息窗口,并希望在windows 7任务栏上实现某种自定义分组。

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

我发现了一些新信息。我可以使用SHGetPropertyStoreForWindow做一些事情,如这里所述: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.

…作为任何应用程序运行窗口的属性。可以通过以下两种方法之一进行设置:如果一个进程拥有的不同窗口需要不同的AppUserModelIDs来控制任务栏分组,那么使用SHGetPropertyStoreForWindow来检索窗口的属性存储,并将AppUserModelID设置为窗口属性。

2 个解决方案

#1


2  

Application User Model IDs says:

应用程序用户模型IDs表示:

"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."

“如果一个进程拥有的不同窗口需要不同的AppUserModelID来控制任务栏分组,那么使用SHGetPropertyStoreForWindow来检索窗口的属性存储,并将AppUserModelID设置为窗口属性。”

#2


0  

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

我用。net的Windows API代码包和下面的代码解决了这个问题:

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.

具有相同id的窗口将被分组在一起——具有唯一id的窗口将有一个单独的任务栏图标。

#1


2  

Application User Model IDs says:

应用程序用户模型IDs表示:

"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."

“如果一个进程拥有的不同窗口需要不同的AppUserModelID来控制任务栏分组,那么使用SHGetPropertyStoreForWindow来检索窗口的属性存储,并将AppUserModelID设置为窗口属性。”

#2


0  

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

我用。net的Windows API代码包和下面的代码解决了这个问题:

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.

具有相同id的窗口将被分组在一起——具有唯一id的窗口将有一个单独的任务栏图标。