uses ShellAPI;
procedure TForm1.Button1Click(Sender: TObject);
begin
//用IE打开
ShellExecute(Handle, 'open', 'IExplore.EXE', 'about:blank', nil, SW_SHOWNORMAL);
//用火狐打开
ShellExecute(Handle, 'open', 'firefox.exe', 'about:blank', nil, SW_SHOWNORMAL);
//用默认浏览器打开
ShellExecute(Handle, 'open', 'Explorer.exe', 'about:blank', nil, SW_SHOWNORMAL);
end;
//另一种调用IE打开的方法
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;
//第二种方法可以有更多控制
procedure TForm1.Button1Click(Sender: TObject);
procedure OpenInIE(aURL: string); //need uses ComObj;
var
IE: Variant;
begin
IE := CreateOleObject('InternetExplorer.Application');
IE.Visible := true; //可见
IE.left := 0;
IE.top := 0;
IE.height := 600; //高度
IE.width := 800; //宽度
IE.menubar := 0; //取消菜单栏
IE.addressbar := 0; //取消地址栏
IE.toolbar := 0; //取消工具栏
IE.statusbar := 0; //取消状态栏
//IE.resizable := 0; //不允许用户改变窗口大小
IE.Navigate(aURL);
end;
begin
OpenInIE('www.132435.com/blog');
end;
打开网页 DELPHI
最新推荐文章于 2024-06-14 20:35:11 发布