When you programmatically want to execute a shell item/path/URI you are forced to pick a verb even when you want to perform the default action (A.K.A. double click). This means passing
NULL as the verb if you are calling ShellExecute[Ex]. When you do this the shell will do its magic to find the default verb:
- Use the verb the user has set as the default.
- If there is no default, use
- If there is no
openverb, use the first verb returned by
open as the verb is a very common mistake and doing that will ignore the users default action if they have made any changes to the verbs for that file-type/URL protocol:
This dialog was removed in Vista but you can still edit the registry manually.
Incredibly the start menu “Search the Internet” feature (AddSearchInternetLinkInStartMenu policy) gets it both right and wrong!
To get the icon Explorer (
Explorer!GetDefaultBrowserNameAndIconIndex) uses the
Shell32!CAssocArray object to Init with
"HTTP" as the ProgId and then correctly calls GetString( ASSOCF_VERIFY, ASSOCSTR_EXECUTABLE, … ) with pwszExtra set to
However, when it is time to launch the browser Explorer (
AssocQueryStringW( 0, ASSOCSTR_EXECUTABLE, L"HTTP", L"open", ... ) and forcing
"open" can actually make ASSOCSTR_EXECUTABLE return the wrong .exe if the user has changed the default verb! (It is actually documented that it determines the default browser this way)