从任务栏取消分离单独的进程 [英] Ungrouping Separate Processes From The Taskbar

查看:315
本文介绍了从任务栏取消分离单独的进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C ++和Qt编写一个应用程序,用户可以在同一台机器上运行多个实例。应用程序的每个实例都有两到三个窗口与它们相关联。目前,应用程序及其窗口的所有实例都被分组在任务栏(顶部图像)中。我想让每个进程在任务栏中有自己的组(底部图像)。如何实现?

I'm writing an application using C++ and Qt which the user can run multiple instances of on the same machine. Each instance of the application has two to three windows associated with them. At the moment, all instances of the application and their windows are grouped together in the taskbar (top image). I want each process to have its own group in the taskbar (bottom image). How can this be achieved?

推荐答案

您可以为某些窗口或某些进程设置不同的应用程序ID。这是Windows用于确定是否对图标进行分组。

You can set a different application ID for certain of the windows, or certain of the processes. This is what Windows uses to determine whether to group the icons or not.

请参阅这篇文章: http://msdn.microsoft.com/en-us/magazine/dd942846.aspx

Pertinent引用:

Pertinent quote:

设置进程的应用程序ID涉及从shell32.dll调用 SetCurrentProcessExplicitAppUserModelID Win32函数。设置窗口的应用程序ID需要调用 SHGetPropertyStoreForWindow 函数,然后处理返回的 IPropertyStore 对象。以下示例显示如何执行此操作:

Setting the application ID for a process involves a call to the SetCurrentProcessExplicitAppUserModelID Win32 function from shell32.dll. Setting the application ID for a window requires calling the SHGetPropertyStoreForWindow function and then manipulating the returned IPropertyStore object. The following example shows you how to do this:

PROPVARIANT pv; 
InitPropVariantFromString(L"MyAppID", &pv);
IPropertyStore* pps;
VERIFY(SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pps))); 
VERIFY(pps->SetValue(PKEY_AppUserModel_ID, pv)); 
VERIFY(pps->Commit());

这篇关于从任务栏取消分离单独的进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆