chami.com/tips/
Last  Home  Next
 Internet
 Programming
 Windows


Click for details
Keywords
Delphi 2.x
Delphi
Explorer
Functions
Source Code
Win32

How to call Internet Explorer from Delphi

    See Also
  Explore your documents, programs and URLs
  How to tell Netscape Navigator which web pages to load from your Delphi program

Now that Internet Explorer is a standard part of Windows NT 4.0 and future versions of Windows [95], you may find it useful to add a hot key to your program which will take the user to your home page. Here's a simple function which will do just that:

program iexplor;

uses
  Windows, OLEAuto;


procedure OpenInternetExplorer( sURL : string );
const
  csOLEObjName = 'InternetExplorer.Application';
var
  IE        : Variant;
  WinHanlde : HWnd;
begin
  if( VarIsEmpty( IE ) )then
  begin
    IE := CreateOleObject( csOLEObjName );
    IE.Visible := true;
    IE.Navigate( sURL );
  end else
  begin
    WinHanlde := FindWIndow( 'IEFrame', nil );
    if( 0 <> WinHanlde )then
    begin
      IE.Navigate( sURL );
      SetForegroundWindow( WinHanlde );
    end else
    begin
      // handle error ...
    end;
  end;
end;

begin
  OpenInternetExplorer( 'microsoft.com' );
end.

 
Related Links Email Print 
Created on 3-Nov-1996. Source code colorized using CodeColorizer.
Copyright (C) 1996-99 Chami.com All Rights Reserved. Reproduction in whole or in part
or in any form or medium without express written permission of Chami.com is prohibited.
Information on this page is provided as-is without warranty of any kind. Use at your own risk.
Free Downloads | Products & Services | Privacy Statement | Terms & Conditions | Advertising Info