1.不关闭IE刷新IE设置的函数?
InternetSetOption()吗?好像用不到。还是其它。想不起来了。2.有无办法让程序捕捉到某个IE窗口关闭的消息。
关闭IE窗口时发送消息给我的程序?好像不可能吧?
定时检查某IE窗口是否已经关闭?太耗资源了点?请教!谢谢!
有代码最佳,送上200分。zdcnow
2003-3-3
InternetSetOption()吗?好像用不到。还是其它。想不起来了。2.有无办法让程序捕捉到某个IE窗口关闭的消息。
关闭IE窗口时发送消息给我的程序?好像不可能吧?
定时检查某IE窗口是否已经关闭?太耗资源了点?请教!谢谢!
有代码最佳,送上200分。zdcnow
2003-3-3
InternetSetOption(nil,INTERNET_OPTION_SETTINGS_CHANGED, nil,0);
use ?
谢谢各位.问题1解决,谢谢 outer2000(天外流星) 和 sysu(死树) !问题2 ?
function OpenLink:Boolean;
function RequestData(const Item:String):Pchar;
procedure CloseLink;其中,参数Service为DDE服务器的ApplicationName,对IE来说就是Iexplore;参数Topic是DDE会话的TopicName,不同功能对应的Topic不同;参数Item为会话的ItemName,也因功能不同而不同。函数SetLink用来设置会话主题,若成功返回True,否则返回False;函数RequestData用来返回会话的数据。 在uses中加入对DDEman,ShellAPE和ComObj单元的引用,并定义一个TDdeClientConv类型的全局变量DDE。
编写相关代码
......
var DDE:TDdeClientConv;
//DDE为客户端全局变量
implementation
{$R *.DFM}
//创建窗体时创建DDE客户端
procedure TForm1.FormCreate(Sender: TObject);
begin
DDE:=TDdeClientConv.Create(Self);
end;
//单击Open IE启动默认浏览器并自动打开指定的网页(若IE不是默认浏览器,需手工打开)
procedure TForm1.Button3Click(Sender: TObject);
begin
//调用ShellExecute打开默认浏览器,将窗口模式设为SW_SHOWNORMAL
ShellExecute(Handle,nil,PChar('http://www.chinaren.com/index.shtml'),
nil,nil,SW_SHOWNORMAL);
end;
//单击Get URL按钮获取IE地址栏URL以及对应窗口标题
procedure TForm1.Button1Click(Sender: TObject);
begin
//设置会话连接成功
if DDE.SetLink('Iexplore', 'WWW_GetWindowInfo') then
begin
DDE.OpenLink;
//返回信息并在组件Edit1中显示
Edit1.Text:=DDE.QequestData('-1');
DDE.CloseLink;
end
else
ShowMessage('IE没在运行');
end;
//单击Open URL按钮链接到指定网页
procedure TForm1.Button2Click(Sender: TObject);
begin
if DDE.SetLink('Iexplore', 'WWW_
OpenURL') then
begin
//链接到指定Web页
DDE.OpenLink;
DDE.RequestData(Edit2.Text);
DDE.CloseLink;
end
else
ShowMessage('IE没在运行');
end;
//单击Activate IE按钮激活最近打开的IE窗口
procedure TForm1.Button4Click(Sender: TObject);
begin
if DDE.SetLink('Iexplore', 'WWW_Activate') then
begin
DDE.OpenLink;
DDE.RequestData('-1');
DDE.CloseLink;
end
else
ShowMessage('IE没有运行');
end;
//单击Close IE按钮关闭最近打开的IE窗口
procedure TForm1.Button5Click(Sender: TObject);
begin
if DDE.SetLink('Iexplore', 'WWW_Exit') then
begin
DDE.OpenLink;
DDE.RequestData('WWW_Exit');
DDE.CloseLink;
end
else
ShowMessage('IE没有运行');
end.