[英]How can I avoid that the taskbar buttons get combined for my application when the user opens it twice?
In more recent versions of Windows the taskbar will combine two buttons together when I open the same application twice. 在Windows的最新版本中,当我两次打开同一应用程序时,任务栏会将两个按钮组合在一起。 What can I do to avoid that (not counting changing the Windows settings, because I want it for my application only, not all applications).
我该怎么做才能避免这种情况(不包括更改Windows设置,因为我只希望将其用于我的应用程序,而不是所有应用程序)。
Raymond Chen has detailed how to do this a while ago on his blog: How do I customize how my application windows are grouped in the Taskbar? Raymond Chen不久前在他的博客上详细介绍了如何执行此操作: 如何自定义应用程序窗口在任务栏中的分组方式? :
:
All the information in this article came from the article Application User Model IDs (AppUserModelIDs) in MSDN.
本文中的所有信息均来自MSDN中的文章应用程序用户模型ID(AppUserModelIDs) 。
Okay, so suppose your application is really a runtime for other applications.
好的,假设您的应用程序确实是其他应用程序的运行时。 What you need to do is assign a different AppID to each of the applications you are hosting.
您需要做的是为您托管的每个应用程序分配一个不同的AppID。 The mechanism for this is up to you.
机制由您决定。 Your applications might explicitly provide a unique ID, or you may be able to infer one.
您的应用程序可以显式提供唯一的ID,或者您可以推断一个。 For example, if you are Internet Explorer and your "applications" are pinned Web sites, you can use the URL of the site being pinned as the unique ID.
例如,如果您是Internet Explorer,并且“应用程序”是固定的网站,则可以使用被固定的站点的URL作为唯一ID。
You then get to take your unique IDs and create AppIDs for them.
然后,您将获取自己的唯一ID并为其创建AppID。 The format of an AppID is
AppID的格式为
CompanyName.ProductName.SubProduct.VersionInformation
where the SubProduct is optional, and the VersionInformation is present only if you want different versions of your app to be treated as distinct.
其中SubProduct是可选的,仅当您希望将不同版本的应用程序视为不同版本时,才显示VersionInformation。 (If you want an upgraded version to be a replacement for the old version, then omit the VersionInformation so that the old and new versions use the same AppID.)
(如果您希望升级后的版本替代旧版本,请省略VersionInformation,以便新旧版本使用相同的AppID。)
You then assign this AppID to every window associated with the "application".
然后,您将此AppID分配给与“应用程序”关联的每个窗口。 You can do this for an entire process by calling
SetCurrentProcessExplicitAppUserModelID
, or you can do it on a window-by-window basis by setting thePKEY_AppUserModel_ID
property.您可以通过调用
SetCurrentProcessExplicitAppUserModelID
在整个过程中执行此操作,也可以通过设置PKEY_AppUserModel_ID
属性在PKEY_AppUserModel_ID
窗口中执行此PKEY_AppUserModel_ID
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.