多实例,应用程序从最小化和隐藏到活动

编程入门 行业动态 更新时间:2024-10-25 18:25:11
本文介绍了多实例,应用程序从最小化和隐藏到活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

我当前正在通过发送一条消息来执行此操作,并让前一个实例将其自身称为ShowWindow(1).但是,我不明白为什么MSDN文章 msdn.microsoft/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.

更多推荐

多实例,应用程序从最小化和隐藏到活动

本文发布于:2023-11-04 05:18:25,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:最小化   应用程序   实例

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!