首页 > Windows开发 > 详细

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

时间:2020-12-03 22:10:11      阅读:105      评论:0      收藏:0      [点我收藏+]
来自

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.

 

 

文库

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!