https://blog.csdn.net/zisongjia/article/details/69398143

正好要用,做个记录。Mark下。

使用了第一种

uses shellapi
procedure TForm1.Button2Click(Sender: TObject);
begin
ShellExecut(Application.Handle, nil, 'http://www.sharejs.com', nil, nil, SW_SHOWNORMAL); end;

Delphi打开网址链接的几种方法: 
1: 
用默认浏览器打开

uses shellapi
procedure TForm1.Button2Click(Sender: TObject);
begin
ShellExecut(Application.Handle, nil'http://www.sharejs.com'nilnil, SW_SHOWNORMAL);
 
end;

2: 
用IE浏览器打开的3种方法:

uses shellapi
procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(Application.Handle,'open','Iexplore.exe','http://www.sharejs.com',nil,SW_SHOWNORMAL);
end;
 
procedure TForm1.Button2Click(Sender: TObject);
begin
ShellExecute(Application.Handle, nil'http://www.haotu.net'nilnil, SW_SHOWNORMAL);
end;
 
 
//该代码片段来自于: http://www.sharejs.com/codes/delphi/9051
uses SHDocVw;
 
procedure TForm1.Button4Click(Sender: TObject);
var
IE : OleVariant;
begin
IE := CoInternetExplorer.Create;
IE.Visible := True;
IE.Navigate2('http://cy03wqh.blog.163.com');
end;
 
 
//该代码片段来自于: http://www.sharejs.com/codes/delphi/9051

3:

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('http://www.sharejs.com');
end;
 
 
//该代码片段来自于: http://www.sharejs.com/codes/delphi/9051

4:用WebBrowser控件

procedure TForm1.FormCreate(Sender: TObject);
begin
WebBrowser1.Align := alTop;
WebBrowser1.Navigate('http://www.sharejs.com');
end;

Delphi中打开网页连接的几种方法的更多相关文章

  1. 在Delphi中使用C++对象(两种方法,但都要改造C++提供的DLL)

    Delphi是市场上最好的RAD工具,但是现在C++占据着主导地位,有时针对一个问题很难找到Delphi或Pascal的解决方案.可是却可能找到了一个相关的C++类.本文描述几种在Delphi代码中使 ...

  2. Delphi中实现文件拷贝的三种方法

    1.调用API函数procedure CopyFile(FromFileName,ToFileName:string);varf1,f2:file;BeginAssignFile(f1,FromFil ...

  3. node服务器中打开html文件的两种方法

    方法1:利用 Express 托管静态文件,详情查看这里 方法2:使用fs模块提供的readFile方法打开文件,让其以text/html的形式输出. 代码: var express = requir ...

  4. 在Chrome中打开网页时出现以下问题 您的连接不是私密连接 攻击者可能会试图从 x.x.x.x 窃取您的信息(例如:密码、通讯内容或信用卡信息)

    现象:在Chrome中打开网页时出现以下问题 您的连接不是私密连接 攻击者可能会试图从 x.x.x.x 窃取您的信息(例如:密码.通讯内容或信用卡信息). 当点开"了解详情"后显示 ...

  5. 2015.1.25 Delphi打开网址链接的几种方法

    Delphi打开网址链接的几种方法1.使用shellapi打开系统中默认的浏览器              首先需在头部引用 shellapi单元即在uses中添加shellapi,这里我们需要知道有 ...

  6. DELPHI中使用UNIDAC连接ORACLE数据库

    DELPHI中使用UNIDAC连接ORACLE数据库   最近在DELPHI中使用到UNIDAC连接到oracle数据库,这样可以不要安装oracle客户端,比较方便使用:所以简单学习了一下,主要是用 ...

  7. 在WPF程序中打开网页:使用代理服务器并可进行JS交互

    本项目环境:使用VS2010(C#)编写的WPF程序,通过CefSharp在程序的窗体中打开网页.需要能够实现网页后台JS代码中调用的方法,从网页接收数据,并能返回数据给网页.运行程序的电脑不允许上网 ...

  8. Delphi中动态创建窗体有四种方式

    Delphi中动态创建窗体有四种方式,最好的方式如下: 比如在第一个窗体中调用每二个,主为第一个,第二个设为动态创建 Uses Unit2; //引用单元文件 procedure TForm1.But ...

  9. Delphi 导出数据至Excel的7种方法【转】

    一; delphi 快速导出excel   uses ComObj,clipbrd;   function ToExcel(sfilename:string; ADOQuery:TADOQuery): ...

随机推荐

  1. [Swift]LeetCode581. 最短无序连续子数组 | Shortest Unsorted Continuous Subarray

    Given an integer array, you need to find one continuous subarray that if you only sort this subarray ...

  2. [Swift]LeetCode798. 得分最高的最小轮调 | Smallest Rotation with Highest Score

    Given an array A, we may rotate it by a non-negative integer K so that the array becomes A[K], A[K+1 ...

  3. [Swift]LeetCode882. 细分图中的可到达结点 | Reachable Nodes In Subdivided Graph

    Starting with an undirected graph (the "original graph") with nodes from 0 to N-1, subdivi ...

  4. Prometheus使用入门

    Monitoring with Prometheus读书笔记 原书见: https://www.safaribooksonline.com/library/view/monitoring-with-p ...

  5. Python内置函数(3)——any

    英文文档: any(iterable) Return True if any element of the iterable is true. If the iterable is empty, re ...

  6. PYTHON BS 四大对象

    BeautifulSoup是灵活又方便的网页解析库,处理搞笑,支持多种解析器利用它不用编写正则表达式即可方便地实现网页信息的提取BS的四大对象:1.TagTag就是HTML中的一个个标签,例如:< ...

  7. 『Tarjan算法 无向图的双联通分量』

    无向图的双连通分量 定义:若一张无向连通图不存在割点,则称它为"点双连通图".若一张无向连通图不存在割边,则称它为"边双连通图". 无向图图的极大点双连通子图被 ...

  8. .NET Core微服务系列基础文章索引(目录导航Draft版)

    一.为啥要写这个系列? 今年从原来的Team里面被抽出来加入了新的Team,开始做Java微服务的开发工作,接触了Spring Boot, Spring Cloud等技术栈,对微服务这种架构有了一个感 ...

  9. 什么?你竟然还没有用这几个chrome插件?

    前言 其实18年之前写过一篇关于chrome插件的文章,里面安利了4个chrome插件.鉴于这已经是9102年了,之前觉得好用的chrome插件跟新了解到的比起来,还是差了那么点味道.所以决定再更新一 ...

  10. 用PMML实现机器学习模型的跨平台上线

    在机器学习用于产品的时候,我们经常会遇到跨平台的问题.比如我们用Python基于一系列的机器学习库训练了一个模型,但是有时候其他的产品和项目想把这个模型集成进去,但是这些产品很多只支持某些特定的生产环 ...