使用winforms或wpf等桌面应用程序在Windows 7 / 8.x / 10上调用邮件应用程序 [英] Invoke a mail application on windows 7/8.x/10 using an desktop application like winforms or wpf

查看:65
本文介绍了使用winforms或wpf等桌面应用程序在Windows 7 / 8.x / 10上调用邮件应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个桌面应用程序,它使用MAPI dll来调用用户计算机上的默认邮件应用程序。这个应用程序是使用DotNet 4.5在winforms中开发的。如果我是正确的,目前mapi驱动程序检查注册表以找出默认的邮件应用程序设置。
因为在Windows 10中,注册表在更改默认邮件时没有正确更新。


是否有人指导我使用常见的Windows API来帮助我找出默认应用程序(Mail)而不是使用注册表。


解决方案

Neelesh bodgal,


感谢您在此处发帖。


>>是否有人指导我了解可以帮助确定默认值的常见Windows API应用程序(邮件)而不是使用注册表。


对于这种情况,我建议你尝试以下这些方法。


1。拨打
ShellExecute
方法发送电子邮件命令。

 ShellExecute(IntPtr.Zero,"open",
" mailto:username?subject = Subject& body = Content",
"","",4 / * sw_shownoactivate * /);

2。使用
System.Diagnostics.Process
创建一个新的电子邮件流程。

 System.Diagnostics.Process proc = new System.Diagnostics.Process(); 
proc.StartInfo.FileName =" mailto:Username?subject = Subject& body = Content" ;;
proc.Start();

希望这可以帮助你。


最好的问候,


Baron Bi






I have a desktop application which uses MAPI dll to invoke a default mail application on users machine. This app is developed in winforms using DotNet 4.5. If i'm correct, currently mapi driver checks registry to figure out the default mail app settings. Since in windows 10, registry is not updated correctly as observed when default mail is changed. 

Does anybody direct me about a common windows api that can help figure out the default applications(Mail) instead of using a registry.

解决方案

Hi Neelesh bodgal,

thanks for posting here.

>>Does anybody direct me about a common windows api that can help figure out the default applications(Mail) instead of using a registry.

For this case, I suggest you try these ways below.

1. Call ShellExecute method to send email command.

ShellExecute(IntPtr.Zero, "open",
            "mailto:username?subject=Subject&body=Content",
            "", "", 4 /* sw_shownoactivate */);

2. Use System.Diagnostics.Process to create a new email process.

System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "mailto:Username?subject=Subject&body=Content";
proc.Start();

Hope this could be help of you.

Best Regards,

Baron Bi



这篇关于使用winforms或wpf等桌面应用程序在Windows 7 / 8.x / 10上调用邮件应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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