设置其他进程的应用程序用户模型ID

发布于 2024-10-19 13:34:27 字数 398 浏览 5 评论 0原文

我有一个启动器应用程序可以启动另一个应用程序。为了使其他应用程序能够与 Windows 7 的任务栏完美配合,我必须设置 应用程序用户模型 ID

通常,一个进程必须通过调用 SetCurrentProcessExplicitAppUserModelID() 为自己设置此 id,但在这种特定情况下,我无法控制其他应用程序的启动代码,因此我必须在外部设置此 ID,最好使用某种 ShellExecute它将 ID 传递给应用程序。

这可能吗?

I have a launcher app that starts another app. For the other App to play nicely with Windows 7's taskbars, I have to set the Application User Model ID.

Usually a process has to set this id for itself, by calling SetCurrentProcessExplicitAppUserModelID(), but in this specific case I do not have control about the other apps startup code, so I have to set this externally, at best by using some kind of ShellExecute which passes the ID to the app.

Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

£烟消云散 2024-10-26 13:34:27

如果 Windows 不调用 SetCurrentProcessExplicitAppUserModelID,它将自动为进程生成一个 id,这对于最近的文件跳转列表部分来说应该足够了。

如果您出于某种原因确实想为第 3 方应用程序设置特定 id,我会尝试其中之一(我没有尝试过这些建议中的任何一个),

  • 在应用程序窗口上使用 SHGetPropertyStoreForWindow (我从未尝试过像这样设置 id)这个,但我知道你可以通过这种方式读取另一个进程的ID)
  • 创建一个临时快捷方式,启动具有特定ID的应用程序
  • 注入进程并调用SetCurrentProcessExplicitAppUserModelID

Windows will auto generate a id for the process if it does not call SetCurrentProcessExplicitAppUserModelID, this should be enough for the recent files jumplist section.

If you for whatever reason really want to set a specific id for a 3rd party app, I would try one of these (I have not tried any of these suggestions)

  • use SHGetPropertyStoreForWindow on the apps window (I have never tried to set the id like this, but I know you can read the id of another process this way)
  • Create a temporary shortcut that launches the app with a specific id
  • Inject into the process and call SetCurrentProcessExplicitAppUserModelID
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文