Cry about...
Delphi Programming


How to open a browser on a given URL


To open a browser on a specific given URL use:

ShellExecute(self.WindowHandle,'open','www.cryer.co.uk',nil,nil, SW_SHOWNORMAL);

If the URL is not hard coded but held in a string, then it will need to be explicitly passed as a PChar:

ShellExecute(self.WindowHandle,'open',PChar(url),nil,nil, SW_SHOWNORMAL);

This will open internet explorer on the URL supplied, or whichever is the default browser.

Related notes:


These notes are believed to be correct for Delphi 6, but may apply to other versions as well.



About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.