老问题了:
看看“小人物”的回答:
uses Registry;
procedure setyourIE;
var
Reg:TRegistry;
begin
Reg:= TRegistry.Create;
with Reg do
begin
RootKey:=HKEY_CLASSES_ROOT;
if OpenKey('htmlfile/shell',false) then
writeString('','yourIE');
CloseKey;
if OpenKey('htmlfile/shell/yourIE/command',true) then
writeString('','c:/yourIE.exe "%1"');
CloseKey;
if OpenKey('http/shell',false) then
writeString('','yourIE');
CloseKey;
if OpenKey('http/shell/yourIE/command',true) then
writeString('','c:/yourIE.exe "%1"');
CloseKey;
if OpenKey('https/shell',false) then
writeString('','yourIE');
CloseKey;
if OpenKey('https/shell/yourIE/command',true) then
writeString('','c:/yourIE.exe "%1"');
CloseKey;
free;
end;
end;
function check: boolean;
var
Reg:TRegistry;
begin
result:=true;
Reg:= TRegistry.Create;
with Reg do
begin
RootKey:=HKEY_CLASSES_ROOT;
if OpenKey('htmlfile/shell',false) then
if readString('')<>'yourIE' then result:=false;
CloseKey;
if OpenKey('http/shell',false) then
if readString('')<>'yourIE' then result:=false;
CloseKey;
if OpenKey('https/shell',false) then
if readString('')<>'yourIE' then result:=false;
CloseKey;
free;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
if not check then
if MessageDlg('yourIE不是当前的默认网络浏览器'+#10#13
+'你是否愿意yourIE设置为你的默认网络浏览器',mtConfirmation, [mbYes, mbNo], 0) = mrYes then
setyourIE;
end;