Archive

Archive for the ‘Internet / LAN’ Category

How to Start Microsoft Internet Explorer

December 15th, 1999 m3Rlin 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/');

How to Hide TWebBrowser Scrollbars

December 15th, 1999 m3Rlin No comments

If you want to block the ability to use scrollbars in TWebBrowser then you can simply hide them. Here’s the code that’ll do that.

...
with WebBrowser1.OleObject.Document.Body.Style do
  OverflowX := 'hidden';
  OverflowY := 'hidden';
end;
...