...OLE with the internet explorer?

Author: Simon Grossenbacher
Homepage: http://www.swissdelphicenter.ch

Category: Objects/ActiveX

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
      
ShowMessage('Can''t open IE !');
  end;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
  
OpenIE('http://www.swissdelphicenter.ch');
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base