Brian Cryer

 

Cry about...
Delphi Programming


How to open internet explorer at a specific screen location with a specific size etc


To open internet explorer at a specific screen location, with a specific size and with control over other characteristics (such as whether the address bar and scroll bar are visible):

procedure OpenIE();
var
  ie: IWebBrowser2;
  Url, Flags, TargetFrameName, PostData, Headers: OleVariant;
begin
  // Uses ComObj + SHDocVw_TLB
  ie := CreateOleObject('InternetExplorer.Application') as IWebBrowser2;
  ie.Left := 100;
  ie.Top := 100;
  ie.Width := 640;
  ie.Height := 400;
  ie.MenuBar := false;
  ie.AddressBar := false;
  ie.Resizable := false;
  ie.StatusBar := false;
  ie.ToolBar := 0;
  Url := 'www.cryer.co.uk';
  ie.Navigate2(Url,Flags,TargetFrameName,PostData,Headers);
  ie.Visible := true;
end;

This code is fairly self explanatory, so I won't bore you with an explanation.

Related notes:


These notes are believed to be correct for Delphi 6 and may apply to other versions as well.



About the author: is a dedicated software developer and webmaster. For his day job he develops websites and desktop applications as well as providing IT services. He moonlights as a technical author and consultant.