阅读 74

Delphi7 获取默认浏览器 打开指定网页url地址

来自

unit Unit1;

百度

 

interface

 

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls,Registry,ShellAPI;

 

type

TForm1 = class(TForm)

lbl1: TLabel;

edt1: TEdit;

lbl2: TLabel;

edt2: TEdit;

btn1: TButton;

btn2: TButton;

procedure FormCreate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

 

var

Form1: TForm1;

 

implementation

 

{$R *.dfm}

 

procedure TForm1.FormCreate(Sender: TObject);

 

var

reg: TRegistry;

s: String;

 

begin

reg := TRegistry.Create;

reg.RootKey := HKEY_CLASSES_ROOT;

reg.OpenKey(‘HTTP\Shell\open\command‘,False);

s := reg.ReadString(‘‘);//读取注册表的值 如:"D:\Program Files\Maxthon3\Bin\Maxthon.exe" "%1"

s := Copy(s,Pos(‘"‘,s)+1,Length(s));//提取路径信息

s := Copy(s,1,Pos(‘"‘,s)-1);

ShellExecute(handle, ‘open‘,PChar(s), PChar(‘http://www.ccqgn.com‘), nil,sw_shownormal);//指定打开网页

end;

 

end.

 

 

文库

原文:https://www.cnblogs.com/jijm123/p/14081965.html

文章分类
代码人生
版权声明:本站是系统测试站点,无实际运营。本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 XXXXXXo@163.com 举报,一经查实,本站将立刻删除。
相关推荐