Re: TWebBrowser as Active-X component

[ Delphi FAQ -- by DelphiLand ]

Posted by webmaster Guido on October 05, 2003

In Reply to: TWebBrowser posted by Joey on October 01, 2003:

: I am using delphi7 personal and i have looked everywhere for a component that will just allow me to open a web page in my application. I have asked this before jw if anyone has found a decent one ;-) ty!

There are several possibilities:

1. The easiest way is not using a component, but opening the web page in the default browser with the function ShellExecute. This works for all PC's with a browser, whatever the type (IE, FireFox, or other). See: the mini-tutorial "Running an external application" in DelphiLand's section CodeSnips.

2. Use shareware or freeware components. Works even on PC's with no browser. Example: ICS, a freeware Internet component suite, with source included:

3. Only for PC's with an IE browser: use the built-in browser and make an Active-X component of it. In other words: "wrap" the interface to Microsoft's Internet Explorer into a Delphi component. This has been proven to work with all 32 bit Delphi versions, from D2 to D7, including the personal versions. Here's a short "how to":

The Active-X component TWebBrowser allows you to embed a copy of Internet Explorer on a form.

To install it into Delphi:

1. On Delphi's "Component" menu select "Import ActiveX Control..."

2. In the listbox, scroll and and select "Microsoft Internet Controls". The "Class names" should list "TWebBrower".

3. For the "Palette Page" either leave it as "ActiveX" or select "Internet" - according to which toolbar you would like the TWebBrowser control to appear on.

4. Click "Install..."

The TWebBrowser component will now appear on the ActiveX (or Internet) component tab and is available for use.

Note: If you have IE4 or later, then you'll have two components: WebBrowser and WebBrowser_V1. You should use WebBrowser (WebBrowser_V1 is only for backwards compatibility with IE3).

[ Delphi FAQ ]