如何从系统托盘恢复应用程序? ShowWindow 没有帮助,因为 Handle=0

发布于 2024-08-17 04:25:35 字数 132 浏览 11 评论 0原文

是否可以恢复已最小化到系统托盘的第 3 方应用程序?

在最小化到任务栏的应用程序上调用 ShowWindow 是没问题的,但在应用程序已最小化到 SysTray 的情况下,它的句柄似乎被设置为零,当然 ShowWindow 找不到它。

Is it possible to restore a 3rd Party application which has been minimized to the SysTray?

Calling ShowWindow is fine on apps minimized to the TaskBar but where the app has been minimized to the SysTray it appears its handle gets set to zero, and of course ShowWindow can't find it.

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

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

发布评论

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

评论(3

无名指的心愿 2024-08-24 04:25:35

不;可以采取不同的方法来完成此操作(应用程序可能会在恢复时关闭窗口并打开一个新副本,或者可能只是隐藏原始窗口并在恢复时显示它)。应用程序不需要遵循任何特定的过程来实现此功能,因此也没有可以遵循的特定过程来反转它。

如果您了解特定应用程序的行为方式,并且希望将其作为特定情况进行处理,那么这是可能的。但不幸的是,不存在一刀切的解决方案。

编辑

您可以尝试使用Process Explorer确定进程打开了哪些(如果有)窗口句柄。这至少会告诉您它是否正在破坏或隐藏窗户。

No; there are different approaches that can be taken to accomplish this (the application might close the window and open a new copy when restoring, or it might simply hide the original window and show it upon restoring). There is no particular process that an application needs to follow in order to achieve this functionality, so there's no particular process that can be followed in order to reverse it.

If you have information about how a particular application behaves and you'd like to deal with it as a specific case, then that might be possible. But a one-size-fits-all solution unfortunately doesn't exist.

Edit

You can try using Process Explorer to determine what (if any) window handles are open by the process. This will at least tell you if it's destroying or hiding the window.

锦欢 2024-08-24 04:25:35

它完全取决于应用程序的实现。更常见的方法是从头开始创建一个新窗口,而不是显示隐藏的窗口。

它通过私有回调函数获取托盘图标通知,您自己无法伪造。假冒鼠标单击很难正确,因为您无法找出图标所在的位置。我认为你被困住了。

It is entirely dependent on the app's implementation. The far more common approach would be for it to create a new window from scratch instead of showing a hidden one.

It gets its tray icon notifications through a private callback function, you can't fake that yourself. Faking a mouse click is very hard to get right because you can't find out where the icon is located. I think you're stuck.

始终不够爱げ你 2024-08-24 04:25:35

Adam Robinson 和 nobugz 提供了有用的建议。帮助我认识到我们正在尝试的事情甚至可能是不可能的。太多取决于应用程序隐藏自身时内部的行为方式,而我们无法控制它,甚至对此了解不多。我们需要从另一个方向来解决这个问题。

该应用程序位于 SysTray 中,等待通过用户鼠标单击它来激活,但我们无法自动执行该操作。但还有另一种“激活”应用程序的方法,那就是再次运行 exe 文件。在这种情况下,不会启动第二个实例,它只是重新激活现有实例。那么为什么不以 Shell 方式打开 exe 文件并重新激活应用程序呢?这就是我们所做的,这是一个可行的解决方案。

Helpful advice from Adam Robinson and nobugz. Helped me to see that what we are attempting might not even be possible. Too much depends on how the app is behaving internally when it hides itself and we don't control that or even know much about it. We needed to approach this from another direction.

The app sits in the SysTray waiting to be activated via the user mouse clicking on it, but we can't automate that. But there's another way of "activating" the app and that's by running the exe file again. In this case, that doesn't start a second instance, it just reactivates the existing instance. So why not Shell out to the exe file and reactivate the app that way? That's what we did and it is a working solution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文