How to Start Microsoft Internet Explorer
December 15th, 1999
No comments
Since Internet Explorer is a part of Microsoft Windows 95 (OSR 2 and OSR 2.1), 98, ME, NT, 2000, XP or Windows Vista you may want to add a link to your home page that will start Microsoft Internet Explorer (MSIE). Here’s the code to do so:
uses
Windows, {$ifdef ver90} OLEAuto {$else} ComObj {$endif};
...
procedure StartIE(sURL: string);
var
hwndHandle: HWnd;
vIE: Variant;
begin
if VarIsEmpty(vIE) then begin
vIE := CreateOleObject('InternetExplorer.Application');
vIE.Visible := True;
vIE.Navigate(sUrl);
end else begin
hwndHandle := FindWindow('IEFrame', nil);
if hwndHandle <> 0 then begin
vIE.Navigate(sURL);
SetForegroundWindow(hwndHandle);
end else
ShowMessage('Can''t open Microsoft Internet Explorer!');
end;
end;
Example:
StartIE('http://www.delphifaq.net/');