多实例,应用程序从最小化和隐藏到活动 [英] Multiple instance,Application from Minimized and Hide to Active

查看:131
本文介绍了多实例,应用程序从最小化和隐藏到活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个支持单个实例的应用程序.我获得了上一个实例窗口的句柄,现在必须将上一个实例的窗口置于活动状态(从最小化",隐藏"或只是将焦点移到另一个窗口).

我当前正在通过发送一条消息来执行此操作,并让前一个实例将其自身称为ShowWindow(1).但是,我不明白为什么MSDN文章 http://msdn.microsoft.com/en-us/library/ms632668(VS. 85).aspx 反对....

MSDN>>>它不应在前一个实例的窗口中发布消息,要求它自己调用SetForegroundWindow

MSDN>>> It should not post a message to the window of the previous instance asking it to call SetForegroundWindow on itself

那么,如何从其他实例激活窗口(其他进程)?

推荐答案

如果我的理解是正确的,那么您突出显示的文本更适用于运行Windows 98/95的系统. br>
它不应在前一个实例的窗口中发布消息要求它自己调用SetForegroundWindow,因为前一个实例不一定具有调用 SetForegroundWindow的权限. /b>

提到的另一点是您不应发布消息,请尝试使用 sendmessage 函数而不是postmessage函数.我认为一旦您拥有窗口的句柄,调用showwindow应该就可以正常工作.
Well if my understanding is correct, the text you highlighted is more applicable to systems running windows 98/95.

It should not post a message to the window of the previous instance asking it to call SetForegroundWindow on itself, because the previous instance will not necessarily have permission to call SetForegroundWindow.

Another point mentioned is that you should not post message, try using sendmessage function instead of postmessage function. I think calling showwindow should work fine once you have the handle to the window.


这篇关于多实例,应用程序从最小化和隐藏到活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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