如何在Vista中使用C ++将窗口带到前台? [英] How can I bring a window to the foreground in Vista using C++?

查看:156
本文介绍了如何在Vista中使用C ++将窗口带到前台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一段代码,使窗口下的光标到前台使用SetForegroundWindow API for WinXP。我一直在测试它的Vista,但API似乎不再正确工作。

I have a piece of code that brings the window under the cursor to the foreground using the SetForegroundWindow API for WinXP. I have been testing it for Vista but the API seems to no longer do the job correctly.

AllowSetForeground没有帮助,我的过程是一个后台进程。

AllowSetForeground did not help, my process is a background process.

我可以用什么来完成这个?

What can I use to accomplish this?

推荐答案

尝试以下代码,看看它是否适用于您:

Try the following code and see if it works for you:

SetWindowPos(WndHandle,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);
SetWindowPos(WndHandle,HWND_NOTOPMOST,0,0,0,0,SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);

这篇关于如何在Vista中使用C ++将窗口带到前台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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