Delphi - Win7窗口焦点问题 [英] Delphi - Win7 Window Focus Issue
问题描述
,但它不能在Win7中工作,所以我必须点击任务栏中的图标。
如何实现我想要的行为(即启动BringToForeground)?
您甚至不应该尝试这样做。 SetForegroundWindow 中的更改是有意的 - 它可以防止从用户想要关注的焦点的应用程序。请参阅上面的链接的注释部分。
Win7可能不会让非管理员用户更改所需的注册表设置,更不用说重新启动系统。
您应该只使用 I execute exe file by CreateProcess() and set foreground process by SetForegroundWindow().
but it doesn't work in Win7 so I have to click icon in taskbar. How can I implement the behaviour I want (which is to Launch and BringToForeground)? You shouldn't even try to do this. The change in SetForegroundWindow was intentional - it prevents applications from stealing the focus from what the user wants to have focus. See the Remarks section of the link above. Win7 probably won't let non-administrative users change the needed registry setting, much less do it without a restart of the system. You should just use FlashWindow instead to get the user's attention, as Microsoft recommends. Any application that insists on stealing focus away from what I choose to do will be uninstalled immediately. 这篇关于Delphi - Win7窗口焦点问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!