如何确保 MAPI 客户端在启动时获得焦点?
我有一个功能可以通过 MAPI 启动用户的默认电子邮件程序。邮件程序通常在我的应用程序之上启动,但有时不会;有时我的应用程序保留在桌面显示的顶部。有什么方法可以确保用户的电子邮件程序将在桌面上启动,而不是隐藏在其他打开的应用程序后面?
I've got a function that launches a user's default e-mail program via MAPI. The mail program usually launches on top of my app, but sometimes it doesn't; sometimes my application remains on top of the desktop display. Is there any way to assure the user's e-mail program will launch on top of the desktop, not buried behind other open applications?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用 findwindow api 找到您想要位于顶部的窗口,然后调用 setforegroundwindow api
you need to find the window wich you want to be on top using findwindow api an then call setforegroundwindow api
我认为带有 SW_SHOWNORMAL 或 SW_SHOW 标志的 ShellExecute 是您可以做的最佳解决方案。与 mailto: 参数结合使用,它将是这样的:
当然,此方法只能用于创建简单的消息。
I think ShellExecute with SW_SHOWNORMAL or SW_SHOW flag is the best solution you can do. In combination with mailto: argument it will be something like that:
Of course this method can be used only for creating simple messages.