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;