How to open a Web site with the default Web browser in a NEW window

Source: Internet
Author: User

Http://delphi.about.com/cs/adptips2004/a/bltip0504_4.htm

When using ShellExecute (as explained on the above article) to open a Web site or an HTM file with the default Web browser You *don ' t* has the option to specify so want to start a new instance of the Browser-in general an existing Windo W is used.

To make sure a new window was created we need to call the ShellExecute function a little differently-by specifying the UR L as a parameter to a call to your default browser (an application associated with the HTM and HTML, etc extension).

usesRegistry, Shellapi;functionBrowseurl (ConstUrl:string): boolean;varBrowser:string;beginResult:=True; Browser:="';  withTregistry.create Do   TryRootkey:=HKEY_CLASSES_ROOT; Access:=Key_query_value; ifOpenkey ('\htmlfile\shell\open\command', False) ThenBrowser:= ReadString ("') ;   Closekey; finallyFree ; End; ifBrowser ="'  Then   beginResult:=False;   Exit; End; Browser:= Copy (Browser, Pos ('"', Browser) +1, Length (Browser)); Browser:= Copy (Browser,1, Pos ('"', Browser)-1) ; ShellExecute (0,'Open', PChar (Browser), PChar (URL),Nil, sw_show);End;//Usagebrowseurl ('http://www.cnblogs.com') ;

How to open a Web site with the default Web browser in a NEW window

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.