OLE with the internet explorer

OLE with the internet explorer

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.infojet.cz/delphi/tips/'); 
end;
Published At
Categories with Web编程
comments powered by Disqus