如何取得ActiveForm所在的服务器IP地址? 由于ActiveForm中要用到Indy的IdTCPClient和服务端的程序用IdTCPServer连接,需要知道服务器的IP地址。服务端的程序是用IdHTTPServer1做网络访问服务的。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 uses ActiveX,MSHtml;//在ActiveForm中调用,参数x就是 selffunction GetCurrentPageUrl(x : TActiveForm): String;var i_hd : IHTMLDocument2; i_oc : IOleContainer;begin Result:=''; try if (x.ActiveFormControl.ClientSite.GetContainer(i_oc) = S_OK) and (i_oc.QueryInterface(IHTMLDocument2, i_hd) = S_OK) then begin Result:=String(i_hd.location.href); //如果你熟悉javascript的话,i_hd.location.href很容易理解... end else Exit; except Exit; end;end; 如果你熟悉javascript的话,i_hd.location.href很容易理解...需要知道服务器的IP地址、端口等:i_hd.location.hosti_hd.location.port...... 服务端用的是IdHTTPServer!这两个条件不成立 if (x.ActiveFormControl.ClientSite.GetContainer(i_oc) = S_OK) and (i_oc.QueryInterface(IHTMLDocument2, i_hd) = S_OK) theni_hd.location.host 得到是空的。 我给的代码适用于ActiveForm嵌在Web页面中,并通过IE访问的情况,不太明白,你的ActiveForm如何使用的? 是通过IE访问的,用的是DEPHI自动生成的Index.htm. FDocument.location.host 就是啊 不好意思,FDocument.location.host也是空的。服务端的程序是用IdHTTPServer的。 我如何发带图片的帖子啊? 如何判断自定义指针的类型? 我用DELPHI2009自动创建一个Mdi程序,点Exit后想退出,却造成我的电脑死机了, 如何操作TWordDocument 中的 Table ?我就知道 类似 aTable.Cell(1,1).Range.Text:='11111'; 的动作。 怎样使窗体一直保持透明~~~~ 请问大家在哪里可以下载如下的Delphi 书籍 如何在OCX控件中定义系统热键? 控件的使用 请问delphi的C/S模式的一些问题 如何得到报表的总页数? 怎么判断adoquery是处于新增或编辑状态 好可怕。好可怕,倒粪真的好可怕。
ActiveX,MSHtml;
//在ActiveForm中调用,参数x就是 selffunction GetCurrentPageUrl(x : TActiveForm): String;
var
i_hd : IHTMLDocument2;
i_oc : IOleContainer;
begin
Result:='';
try
if (x.ActiveFormControl.ClientSite.GetContainer(i_oc) = S_OK) and
(i_oc.QueryInterface(IHTMLDocument2, i_hd) = S_OK) then
begin
Result:=String(i_hd.location.href);
//如果你熟悉javascript的话,i_hd.location.href很容易理解...
end
else
Exit;
except
Exit;
end;
end;
i_hd.location.host
i_hd.location.port
...
...
服务端用的是IdHTTPServer!
这两个条件不成立
if (x.ActiveFormControl.ClientSite.GetContainer(i_oc) = S_OK) and
(i_oc.QueryInterface(IHTMLDocument2, i_hd) = S_OK) theni_hd.location.host 得到是空的。
不太明白,你的ActiveForm如何使用的?
服务端的程序是用IdHTTPServer的。