看这个代码,别忘了在interface uses 加入 ComObj 单元。procedure OpenIE(aURL: string);
var
IE : Variant;
WinHanlde : HWnd;
begin
if( VarIsEmpty(IE) )then
begin
IE := CreateOleObject('InternetExplorer.Application');
IE.Visible := true;
IE.Navigate(aURL);
end
else
begin
WinHanlde := FindWIndow('IEFrame', nil);
if (0 <> WinHanlde) then
begin
IE.Navigate(aURL);
SetForegroundWindow(WinHanlde);
end
else
// errorhandling
end;
end;
var
IE : Variant;
WinHanlde : HWnd;
begin
if( VarIsEmpty(IE) )then
begin
IE := CreateOleObject('InternetExplorer.Application');
IE.Visible := true;
IE.Navigate(aURL);
end
else
begin
WinHanlde := FindWIndow('IEFrame', nil);
if (0 <> WinHanlde) then
begin
IE.Navigate(aURL);
SetForegroundWindow(WinHanlde);
end
else
// errorhandling
end;
end;
shellexecute(handle,'open','URL','','',sw_show);