获取浏览器的当前页面地址
2008-09-12 21:12
435 查看
function URLInfo(sBrowserPrgFile,sServiceName:string;NetScape:boolean;var Title:string):pchar;
var
DdeClientConv:TDDEClientConv;
StartPtr,EndPtr:pchar;
browseWinName:string;
{参数说明}
{
sBrowserPrgFile:浏览器EXE文件的完整路径名
sServiceName:浏览器的DDE-Service名字,如Netscape是Netscape,IE是'iexplore'
Title:返回当前网页的Title
返回值:pchar的字符串
}
begin
result :=#0;
Title :='';
if (sBrowserPrgFile='') or (not FileExists(sBrowserPrgFile)) then
raise EBrowserNotFoundError.Create('浏览器应用程序不存在!');
ddeClientConv :=TDDEClientConv.Create(nil);
try
with ddeClientConv do
begin
ServiceApplication :=sBrowserPrgFile;
SetLink(sServiceName,'WWW_GetWindowInfo');
StartPtr :=RequesttData('0xFFFFFFFF');
end;
finally
ddeClientConv.Free;
end;
if StartPen^=#0 then
exit;
inc(StartPtr);
EndPtr :=StartPtr;
while (EndPtr^<>'''') do
inc(EndPtr);
EndPtr^=#0;
result :=StartPtr;
StartPtr :=EndPtr+3;
if NetScape then
inc(StartPtr12);
EndPtr :=StartPtr;
if Netscape then
while (EndPtr^<>']') do
inc(EndPtr)
else
while (EndPtr^<>'''') do
inc(EndPtr);
EndPtr^ :=#0;
Title :=StrPas(StartPtr);
end;
var
DdeClientConv:TDDEClientConv;
StartPtr,EndPtr:pchar;
browseWinName:string;
{参数说明}
{
sBrowserPrgFile:浏览器EXE文件的完整路径名
sServiceName:浏览器的DDE-Service名字,如Netscape是Netscape,IE是'iexplore'
Title:返回当前网页的Title
返回值:pchar的字符串
}
begin
result :=#0;
Title :='';
if (sBrowserPrgFile='') or (not FileExists(sBrowserPrgFile)) then
raise EBrowserNotFoundError.Create('浏览器应用程序不存在!');
ddeClientConv :=TDDEClientConv.Create(nil);
try
with ddeClientConv do
begin
ServiceApplication :=sBrowserPrgFile;
SetLink(sServiceName,'WWW_GetWindowInfo');
StartPtr :=RequesttData('0xFFFFFFFF');
end;
finally
ddeClientConv.Free;
end;
if StartPen^=#0 then
exit;
inc(StartPtr);
EndPtr :=StartPtr;
while (EndPtr^<>'''') do
inc(EndPtr);
EndPtr^=#0;
result :=StartPtr;
StartPtr :=EndPtr+3;
if NetScape then
inc(StartPtr12);
EndPtr :=StartPtr;
if Netscape then
while (EndPtr^<>']') do
inc(EndPtr)
else
while (EndPtr^<>'''') do
inc(EndPtr);
EndPtr^ :=#0;
Title :=StrPas(StartPtr);
end;
相关文章推荐
- 获取浏览器的当前页面地址
- 如何获得当前屏幕顶端距离整个页面最上端的距离(即js获取浏览器滚动条距离顶端的距离)
- PHP获取当前页面的URL地址
- DedeCms获取当前页面URL地址的实现方法
- php获取当前页面完整真实的url地址的方法,包括带参数的,总结了三种方法
- aspx页面中获取当前浏览器url
- php获取当前页面的url地址
- php获取当前页面完整URL地址
- jquery/js获取当前页面url地址程序代码
- Android 获取浏览器当前分享页面的截屏
- Android 获取浏览器当前分享页面的截屏
- js/jquery获取当前页面URL地址并判断URL字符串中是否包含某个具体值(获取URL的?或者#)
- JS获取当前网址,JS获取当前域名URL ,JS获取网站完整路径页面地址
- PHP获取当前页面完整url地址,包括参数的函数
- 获取当前页面的URL地址
- js获取当前页面的网址域名地址
- Spring mvc怎么获取当前应用的url地址?即jsp页面中的${contextpath}怎么得到?
- php通过$_SERVER获取当前页面完整URL地址
- 获取当前页面完整URL地址