- Call the appropriate program to open
- Uses SHELLAPI;
- Procedure TForm1. Button1Click (Sender:tobject);
- Begin
- Open With IE
- ShellExecute (Handle, ' open ', ' IExplore.EXE ', ' About:blank ', Nil, SW_SHOWNORMAL);
- Open With Firefox
- ShellExecute (Handle, ' open ', ' Firefox.exe ', ' About:blank ', Nil, SW_SHOWNORMAL);
- Open with default browser
- ShellExecute (Handle, ' open ', ' Explorer.exe ', ' About:blank ', Nil, SW_SHOWNORMAL);
- End
- Another way to call IE open
- Uses comobj;
- Procedure TForm1. Button1Click (Sender:tobject);
- Procedure Openinie (Aurl: string);
- var ie:variant;
- Begin
- IE: = Createoleobject (' internetexplorer.application ');
- IE. Visible: = true;
- IE. Navigate (Aurl);
- End
- Begin
- Openinie (' www.132435.com ');
- End
- The second method can have more control
- Uses comobj;
- Procedure TForm1. Button1Click (Sender:tobject);
- Procedure Openinie (Aurl: string);
- var ie:variant;
- Begin
- IE: = Createoleobject (' internetexplorer.application ');
- IE. Visible: = true; //Visible
- IE. Left: = 0;
- IE. Top: = 0;
- IE. Height: = 600; //Height
- IE. Width: = 800; //Width
- IE. MenuBar: = 0; //Cancel menu bar
- IE. Addressbar: = 0; //Cancel Address bar
- IE. Toolbar: = 0; //Cancel toolbar
- IE. StatusBar: = 0; //Cancel status bar
- IE. Resizable: = 0; //Do not allow user to change window size
- IE. Navigate (Aurl);
- End
- Begin
- Openinie (' www.XXX.com ');
- End
Delphi calls IE Open Web page