如何防止 Windows 中的焦点窃取? [英] How can I prevent focus stealing in Windows?

查看:34
本文介绍了如何防止 Windows 中的焦点窃取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Google 上快速搜索 Windows 中焦点窃取的解决方案,可以发现两个主要的结果类别:

A quick Google search for solutions to Focus Stealing in Windows reveals two main result categories:

  • 人们提出不完整的解决方案,涉及ForegroundLockTimeout 注册表项(或 TweakUI,我相信它只是更改了上述注册表项),这不是很有效.
  • 不断 成群的 Windows 用户抱怨关于.
  • People suggesting incomplete solutions involving the ForegroundLockTimeout registry entry (or TweakUI, which I believe simply changes the aforementioned registry entry), which isn't very effective.
  • Incessant hordes of Windows users complaining about it.

在两种常见情况下特别烦人:

It's particularly annoying in two common scenarios:

  • 当全屏应用聚焦时,某些事情会触发程序在后台弹出一个对话窗口,从而导致全屏应用最小化.

  • Something triggers a program to popup a dialog window in the background while a fullscreen app is focused, causing the fullscreen app to minimize.

当您打字时,一个窗口会窃取焦点,窃取您的所有按键.如果您碰巧按 Space、Enter 或触发键盘快捷键(如 Y 表示 Yes),可能会导致完全不理想的结果.

A window steals focus while you are typing, stealing all of your keystrokes. If you happen to press Space, Enter, or trigger a keyboard shortcut (like Y for Yes), it can cause completely undesirable outcomes.

对于这两种情况中的一种或两种情况,可以应用哪些创造性的解决方案来解决此问题?

What creative solutions can be applied to fix this problem for either or both of these scenarios?

推荐答案

我有一个解决方案的建议,但由于缺乏知识,无法完全实施.

I have one suggestion for how it can be solved, but I cannot implement it completely since I lack the knowledge.

窗口之间的焦点更改必须由调用最有可能位于 shell32 或 user32 中的 Windows API 函数的违规程序引起.一些程序,如 Adob​​e Photoshop,会多次(至少两次)调用,以在启动时强迫用户使用.这个想法是挂钩到这个 API 函数(如果可能)并检查调用的来源.如果它不是来自 explorer.exe(即 Alt+Tabbing 或单击任务栏上的图标),则调用应被所述钩子阻止.

The focus change between windows have to be instigated by the offending program calling a Windows API function located most probably in shell32 or user32. Some progams, like Adobe Photoshop makes the call multiple times (at least twice) to force itself up on the user when it's starting. The idea is to hook into this API function (if possible) and check where the call originates from. If it's not from explorer.exe (i.e. Alt+Tabbing or clicking an icon on the taskbar), then call should be blocked by said hook.

这篇关于如何防止 Windows 中的焦点窃取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆