DELPHI 打开网页的两种方法


本文整理自网络,侵删。

 unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,ComObj,ShellAPI;

type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
implementation

{$R *.dfm}
//方法一 可调整窗口 uses里加入comobj
procedure TForm1.Button1Click(Sender: TObject);
procedure OpenInIe(URL:string);
var
Ie:Variant;
begin
Ie:=CreateOleObject('InternetExplorer.Application');
Ie.visible:=True;
Ie.left:=300; //与左边相隔距离
Ie.top:=200; //与顶部相隔距离
Ie.height:=400; //高度
Ie.width:=600; //宽度
Ie.menubar:=0; //隐藏菜单栏
Ie.toolbar:=0; //隐藏工具栏
Ie.addressbar:=0; //隐藏地址栏
//Ie.statubar:=0; //不可调整大小
Ie.resizable:=0;
Ie.navigate(URL);
end;
begin
OpenInIe('www.hi.baidu.com/yncg2046');
end;

//方法二 正常窗口打开 uses里加入shellapi
procedure TForm1.Button2Click(Sender: TObject);
begin
ShellExecute(Handle,'open','www.hi.baidu.com/yncg2046',nil,nil,SW_SHOWNORMAL)
end;

end.

相关阅读 >>

Delphi program name、process id、window handle、process handle 的转换函数

Delphi xe 安卓开发黑屏的另一种解决办法

Delphi两个取字串长度的函数strlen,length

Delphi判断电脑是否安装了excel

Delphi实现屏幕截图、窗口截图、指定区域截图

Delphi分离汉字和英文字母

Delphi 判断是否为文件名

Delphi 暴力保护进程

Delphi 文件夹重命名

Delphi中判断操作系统是否是windows7

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...

    暂无评论...