Article ID: 174156 - View products that this article applies to.
This article was previously published under Q174156
You can use the Windows API to start the default Internet browser on your system. To do so, you must first determine what Internet browser is registered as the default on your system, and then start that application.
The following Visual Basic example will launch whatever Internet browser is registered as the default on your system. Obviously, at least one Internet browser must be successfully installed and set up on the system for this to work. Also, since this code is highly dependent on the application-file type associations in the HKEY_CLASSES_ROOT hive of the registry, this can lead to unexpected results and exceptions if the registry is damaged. File types and extensions may also be associated with applications other than the browser. For example, HTM or HTML files may be associated with web development software instead of the browser.
Note that both API functions in the following sample return a value of 32 or less on failure, but the error constants are not included in this article. Full error trapping is recommended for any production use of this technique.
For more information, please Search on the following topics in either the Win32 Programmer's Reference or The Microsoft Developer Network (MSDN) Library CD-ROM:
Article ID: 174156 - Last Review: July 1, 2004 - Revision: 2.1
Contact us for more help
Connect with Answer Desk for expert help.