Monday, January 23, 2006
Why do words beginning with "home" get treated as URLs?
Why do words beginning with "home" get treated as URLs?: "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' "