简体   繁体   English

C ++ - 如何隐藏其他应用程序的窗口

[英]C++ - How to hide other application's window

I am trying to create a software(Qt/C++). 我正在尝试创建一个软件(Qt / C ++)。 In which I need a functionality that hiding other application windows based on their window titles. 我需要一个基于窗口标题隐藏其他应用程序窗口的功能。 Hiding means invisible not minimize. 隐藏意味着隐形而不是最小化。 Can any body say how to achieve this?. 任何人都可以说如何实现这个目标吗? I am currently working on Windows platform. 我目前正在使用Windows平台。

Note: If you provide a solution via Qt, it will give more comfort. 注意:如果您通过Qt提供解决方案,它将提供更多的舒适。 Because it provides the platform independency. 因为它提供了平台的独立性。

For Windows, if you have an HWND to another application's window, you can call the ShowWindow function, like this: 对于Windows,如果你有另一个应用程序窗口的HWND ,你可以调用ShowWindow函数,如下所示:

ShowWindow(hWnd, SW_HIDE);

You can get an HWND to another application's window using the FindWindow API function. 您可以使用FindWindow API函数将HWND获取到另一个应用程序的窗口。

Interacting with other applications like this is necessarily platform-specific. 与此类其他应用程序交互必然是特定于平台的。 There is no generic way to do this using Qt, because Qt is a framework for your application, not anybody else's. 有没有通用的方法来做到这一点使用Qt,因为Qt是为您的应用框架,而不是别人的。

Here you can find a tutorial on how to make a window transparent on windows. 在这里,您可以找到有关如何在Windows上使窗口透明的教程。

As mentionied before, you must find the window's handle by it's title using the API. 如前所述,您必须使用API​​通过它的标题找到窗口的句柄。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM