Reason for my vote of 2
Nice short how to but needs to be drastically improved for compatibility. Maybe it would be useful to have an example of what you might do with the returned mail client name?
Better yet; just throw an exception. If it's unable to find a default mail client it should fail, because it's sole purpose is to determine the default mail client.
So I would make it:
public string getDefaultMailClient()
{
try
{
object mailClient = Registry.GetValue(
@"HKEY_LOCAL_MACHINE\SOFTWARE\Clients\Mail", "", "none");
return mailClient.ToString();
}
catch (Exception exGetDefaultMailClient)
{
Util.EscribirLog(exGetDefaultMailClient.Message);
throw new Exception("Unable to determine default mail client", ex);
}
}
You're returning Outlook Express if you're unsuccessful?
Are you joking?
Outlook Express is REMOVED from Windows 7.
Just return a string.Empty if no default client is specified, I'm sure other programmers will understand.
Last Visit: 31-Dec-99 18:00 Last Update: 24-Mar-23 8:31