如何防止窗口被禁用

如何防止窗口被禁用

本文介绍了如何防止窗口被禁用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法防止窗口被停用?

Is there any way to prevent a window from being deactivated? The window is in a different process then mine.

这是Windows操作系统。

This is for Windows.

推荐答案

这样做可能很危险,但解决方案是处理WM_ACTIVATE消息,并检查wParam是否为WA_INACTIVE。这意味着窗口已停用。

Doing this can be dangerous, but the solution is to handle the WM_ACTIVATE message and check if the wParam is WA_INACTIVE. This means the window has been deactivated. When this happens, you can just reactivate it.

要为另一个进程的窗口执行此操作,您需要安装一个消息钩子 SetWindowsHookEx

In order to do this for another process's window, you will need to install a message hook with SetWindowsHookEx.

然而,另一个应用程序可能做同样的事情,使对方在无休止的激活/停用循环中。

However, it is possible that another application could do the same thing, putting each other in an endless loop of activation/deactivation.

这也是绝对不能在个人电脑上运行的软件。

This is also something that should never be done by software that is meant to run on a personal computer.

这篇关于如何防止窗口被禁用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 17:25