使用C#,我怎么能确定哪个程序注册为默认的电子邮件客户端?我并不需要启动的应用程序,我只是想知道它是什么。
Using C#, how can I determine which program is registered as the default email client? I don't need to launch the app, I just want to know what it is.
使用注册表类搜索注册表。该控制台应用程序演示的原理。
Use the Registry class to search the registry. This console app demonstrates the principle.
using System;
using Microsoft.Win32;
namespace RegistryTestApp
{
class Program
{
static void Main(string[] args)
{
object mailClient = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail", "", "none");
Console.WriteLine(mailClient.ToString());
}
}
}