如何向前显示不属于该程序的另一个窗口
我真的很难找到一种方法来打开另一个程序窗口。
例如,我使用FindWindow来查找记事本的句柄。然后,我尝试使用 SetWindowPos(hWnd, 0,0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE); 将窗口向前移动。
但它就是行不通! ShowWindow 也没有!
您能帮忙并给我看一段代码吗?
谢谢
I'm really struggling to find a way of bringing forward another programs window.
For example, I use FindWindow to find the handle of Notepad. I then try to bring the window forward using SetWindowPos(hWnd, 0,0, 0, 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE);
But it just doesnt work!! ShowWindow doesnt either!
Can you please help and maybe show me a snippet of code?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不知道这是否是同一件事,但在 Windows 开发的某个时刻,微软添加了一些过于聪明的“反弹出”代码,可以防止没有焦点的程序取消最小化其窗口...相反,程序栏中的窗口条目只会闪烁。也许存在类似的逻辑阻止非前台程序将其窗口向前移动?
无论如何,这里有一些可以尝试的代码,可能有帮助,也可能没有帮助:
Dunno if this is the same thing or not, but at some point in Windows development Microsoft added some too-clever-by-half "anti-popup" code that would prevent a program that does not have the focus from un-minimizing its windows... instead, the window's entry in the programs-bar would just blink. Perhaps there is similar logic preventing a non-foreground program from bringing its window forward?
In any case, here is some code to try, that might or might not help: