Vitaly from the Suggestion Box asked (with grammatical editing),
Could you explain why Windows starts the web browser if the file name passed to ShellExecute starts with “home”.
First thing to note is that this URL-ization happens only after the ShellExecuteEx
function has tried all the other possible interpretations. If a file named “homestar” is found in the current directory or on the PATH or in the App Paths, then that file will be chosen, as you would expect. Only when the ShellExecuteEx
function is about to give up does it try to “do what you mean”.
What you’re seeing is autocorrection kicking in yet again. If you go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\URL\Prefixes
, you can see the various autocorrection rules that ShellExecute consults when it can’t figure out what you are trying to do. For example, if the thing you typed begins with “www”, it will stick “http://” in front and try again. This is why you can just type “www.microsoft.com” into the Run dialog instead of having to type the cumbersome “http://www.microsoft.com”.
Most of the autocorrection rules are pretty self-evident. Something beginning with “ftp” is probably an FTP site. Something beginning with “www” is probably a web site. But why are strings beginning with “home” also treated as web sites?
For one thing, several web sites have domains whose names begin with “home”. Furthermore, some internet service providers set up their DNS so that non-fully-qualified domain names go to servers that the ISP set up specifically to provide customer services. For example, “mail” would send you to a web-based mail system, and “home” would send you to the ISP’s home page.
The use of “home” has fallen out of fashion of late, so the auto-correction rule isn’t all that useful any more, but the rule stays around because it doesn’t really hurt anybody, and compatibility concerns advise against removing a feature if it isn’t hurting anyone and you aren’t absolutely certain that nobody is still using it. (Heck, if you look at the key, you can see an entry for “gopher”. Like anybody uses gopher any more.)
0 comments