您好,欢迎来到[编程问答]网站首页   源码下载   电子书籍   软件下载   专题
当前位置:首页 >> 编程问答 >> Delphi >> ShellExecute打开 ie,如何在原先IE中更新内容

ShellExecute打开 ie,如何在原先IE中更新内容

来源:网络整理     时间:2016/7/4 17:50:27     关键词:

关于网友提出的“ ShellExecute打开 ie,如何在原先IE中更新内容”问题疑问,本网通过在网上对“ ShellExecute打开 ie,如何在原先IE中更新内容”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题: ShellExecute打开 ie,如何在原先IE中更新内容
描述:

 ShellExecute(hwndle,nil,'C:\Program Files\Internet Explorer\IEXPLORE.EXE','news.sina.com.cn',nil,SW_SHOWNORMAL); 我在delphi应用程序中点击一个按钮后刚才打开的IE网页上更新为 www.163.com,不知道如何实现?


解决方案1:

单一的ShellExecute是不行了,要用DDE来控制IE


unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,DDEman,ShellAPi,ComObj, StdCtrls;
type   TForm1 = class(TForm)     Button1: TButton;     Edit1: TEdit;     Button2: TButton;     Button3: TButton;     procedure FormCreate(Sender: TObject);     procedure Button1Click(Sender: TObject);     procedure Button2Click(Sender: TObject);   private     { Private declarations }   public     { Public declarations }   end; var   Form1: TForm1;   DDE:TDdeClientConv; implementation {$R *.dfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject); begin   DDE:=TDdeClientConv.Create(Self); end; procedure TForm1.Button1Click(Sender: TObject); begin   ShellExecute(Handle,'open','www.sina.com',nil,nil,SW_SHOWNORMAL);    //先打开sina end; procedure TForm1.Button2Click(Sender: TObject); begin   if DDE.SetLink('Iexplore', 'WWW_OpenURL') then   begin     DDE.OpenLink;     DDE.RequestData('www.163.com'); //在原窗口打开163     DDE.CloseLink;   end; end; end.
解决方案2:

你想以news.sina.com.cn作为主页吧,有两种实现方法: 1、在IE中将主页设为news.sina.com.cn,这样调用IE不需要参数 2、传递参数: ShellExecute(self.handle,'open','"C:\Program Files\Internet Explorer\IEXPLORE.EXE" "news.sina.com.cn"',nil,SW_SHOWNORMAL); 


以上介绍了“ ShellExecute打开 ie,如何在原先IE中更新内容”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/2278500.html

相关图片

相关文章