如何确保 MAPI 客户端在启动时获得焦点?

发布于 2024-10-05 10:36:43 字数 124 浏览 10 评论 0原文

我有一个功能可以通过 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

巡山小妖精 2024-10-12 10:36:43

您需要使用 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

孤寂小茶 2024-10-12 10:36:43

我认为带有 SW_SHOWNORMAL 或 SW_SHOW 标志的 ShellExecute 是您可以做的最佳解决方案。与 mailto: 参数结合使用,它将是这样的:

ShellExecute(Self.Handle, nil, '"mailto:[email protected]?subject=This is ' +
  'the subject&body=The message''s first paragraph.%0ASecond paragraph.%0AThird ' +
  'Paragraph."', nil, nil, SW_SHOWNORMAL);

当然,此方法只能用于创建简单的消息。

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:

ShellExecute(Self.Handle, nil, '"mailto:[email protected]?subject=This is ' +
  'the subject&body=The message''s first paragraph.%0ASecond paragraph.%0AThird ' +
  'Paragraph."', nil, nil, SW_SHOWNORMAL);

Of course this method can be used only for creating simple messages.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文