问题标签 [setforegroundwindow]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
29 浏览

python - win32gui.SetForegroundWindow 的问题

在单击当前前景窗口并让它循环并尝试再次将其设置为前景窗口后,我遇到了 SetForegroundWindow 问题。我目前正在使用以下内容进行设置。

在我调用它之后,它会进行 Windows 虚拟键输入,然后在计时器完成后,它会循环返回以再次设置窗口,以防它不再是焦点。我尝试使用以下内容,但它不适用于我的代码,因为它会为我目前正在做的事情添加额外的输入:

当我在循环时选择另一个窗口时,我收到以下错误消息:

所以我在寻找是否有任何替代 SetForegroundWindow 的方法,或者在通过代码的第二次循环调用前台窗口之前必须发送某种密钥的方法。