Question

I ran into an issue. I display an email link in my UI. When the user clicks that link it is opened as such:

LPCTSTR url=L"mailto:myemail@gmail.com?subject=my_subject";
ShellExecute(hParentWnd, _T("open"), url, NULL, NULL, SW_SHOWNORMAL);

This works for as long as the end-user has an email client installed. But what happens if the email client is not installer is that command simply opens the home page in the default web browser.

Any idea how to address this?

Was it helpful?

Solution

You can determine what executable/command handles the mailto: protocol with AssocQueryString("mailto") (or by looking in hkcr\mailto\shell\open\command).

If your lucky this will be empty for a machine with no association set.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top