SetForegroundWindow()工作不一致 [英] SetForegroundWindow() Works Inconsistently

查看:199
本文介绍了SetForegroundWindow()工作不一致的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SetForegroundWindow()来设置前景窗口。大多数时候它工作正常。但是,有时候,不是将窗口放在前台并激活窗口,而是只有窗口的任务栏矩形被按下,因为窗口成功地被带到前台并被激活但窗口没有被带到前台并且有没有人知道为什么会这样,或者更重要的是可靠地设置前景窗口的方法?

我正在使用Windows XP。

解决方案

您无法使用SetForegroundWindow强制窗口到前台。如果您希望通过其他进程将窗口置于前台,请调用 AllowSetForegroundWindow

I am using SetForegroundWindow() to set the foreground window.  Most of the time it works fine.  Sometimes, however, instead of putting the window in the foreground and activating it, only the taskbar rectangle for the window is depressed as it is when the window is successfully brought to the foreground and activated but the window isn't brought to the foreground and activated.

Does anybody know why this is happening or more importantly of a way to reliably set the foreground window?

I am using Windows XP.

解决方案

You can not force a window to the foreground using SetForegroundWindow. If you want your window to be brought to the foreground by another process, call AllowSetForegroundWindow.


这篇关于SetForegroundWindow()工作不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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