更改多窗口应用程序任务栏组中显示的图标
在 Windows 7 上,应用程序可以控制如何在任务栏上对 Windows 进行分组。 Windows 有一些与可执行文件、快捷方式创建方式、程序名称等相关的默认设置,以应用一些默认分组。基于主机的应用程序(例如 Java)的问题在于,许多程序使用相同的可执行文件,因此 Windows 有一些注册表设置来将 javaw.exe 设置为主机应用程序。发生这种情况时,应用程序必须在运行时配置如何对 Windows 进行分组并启用固定到任务栏。我已经设置 应用程序用户模型ID,以便根据需要对 Windows 进行分组。
我还没有找到解决方案的问题是,对于多窗口应用程序:如何设置要在任务栏上使用的稳定图标?应用程序的默认 Windows 行为,例如有两个窗口,每个窗口都有自己的图标,任务栏图标显示第一个打开的窗口的图标,如果该窗口关闭,它将更改为另一个窗口,并且每次打开和关闭窗口时都会重复该过程。
当用户将应用程序固定到任务栏设置时,有一些 API 可以设置图标 System.AppUserModel.RelaunchIconResource 窗口属性,但是文档说这个图标是在应用程序被固定时使用的,所以根据仅当应用程序从该固定的应用程序运行时才使用它,从而为无法固定的应用程序(或者开发人员不想允许固定)留下问题。
有一些选项,例如使用图标生成新的可执行文件(从该应用程序启动 JVM)、使用正确的 AppUserModelID 创建快捷方式。这些对我来说不是解决方案,因为应用程序是使用 Java WebStart/JNLP 分发的,因此应用程序快捷方式是由 Java 创建的,启动器被标记为主机应用程序(因为它应该),
另一个解决方案是设置相同的图标在 Windows 7 上运行时,对于每个窗口,该图标(任务栏除外)在 Aero 模式下的 Windows 7 上不是很突出,但在禁用 Aero 的情况下,它是在 Alt+tab 切换器上使用的图标,没有windows预览,我想留下的东西每个窗口看起来都不同
注意:这是一个标记的 Java,但对于任何使用主机可执行文件(javaw.exe、python.exe ...)的平台来说确实是一个问题
On Windows 7 an application can control how to group their Windows on the taskbar. Windows has some default settings related to the executable, how the shortcut was created, the name of the program, etc. to apply some default grouping. The problem with host based applications like Java, is that the same executable is used by many programs so Windows has some registry settings to set that javaw.exe is a host app. When this happens, applications must configure at runtime how to group Windows and enable pin to taskbar. I am already setting Application User Model IDs in order to group Windows as needed.
The problem that I haven't found solution is that for a multi window application: how to set a stable icon to be used on the taskbar?. The default Windows behavior for an application, say for example with two windows, where each windows has his own icon, the task bar icon shows the icon of the first opened window, if that window is closed it changes to the other one, and the process is repeated every time windows are opened and closed.
There is some API to set the icon when the user pin an application to the taskbar setting System.AppUserModel.RelaunchIconResource window property, but the documentation says that this icon is used when the app is being pinned, so according to that it only is used if the application is running from that pinned applications, leaving the problem open for applications that are not able to be pinned (or that the developer do not want to allow pinning).
There are options like generating a new executable with the icon (launching the JVM from that application), creating a shortcut with the correct AppUserModelID. Those aren't solutions for me because the application is distributed using Java WebStart/JNLP, so the application shortcut is created by Java and the launcher is a marked as a host application (as it should)
the other solution is to set the same icon to each window when running on Windows 7, that icon, with the exception of the taskbar one, is not very prominent on Windows 7 on Aero mode, but with Aero disabled it is, it is the icon used on the Alt+tab switcher without windows previews, something I want to leave looking different for each windows
Note: This is a tagged Java but really is a question for any platform that use a host executable (javaw.exe, python.exe ...)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论