急!!!!!!!!!!!!!!!1111111(0分)

  • 主题发起人 主题发起人 潇洒哥
  • 开始时间 开始时间

潇洒哥

Unregistered / Unconfirmed
GUEST, unregistred user!
请问各位英雄,怎样获得浏览器中当前的网页的网址?
 
好象是这个
document.location.href
 
function URLInfo(sBrowerPrgFile, sServiceName: string; Netscape: boolean; var Title: string): pChar;
{
参数说明:
sBrowerPrgFile: 浏览器exe文件的完整路径名
sServiceName: 浏览器的DDE-Service名字
Netscape是'Netscape',IE是'iexplore'
Title: 返回当前网页的title
返回值: pChar的字符串
}
var
DDEClientConv: TDDEClientConv;
StartPtr, EndPtr: pchar;
browserWinName: string;
begin
result:= #0;
Title:= '';

if (sBrowerPrgFile = '') or (not FileExists(sBrowerPrgFile)) then
raise EBrowserNotFoundError.create('****!浏览器应用程序不存在!');

ddeClientConv:= TDDEClientConv.Create( nil );
try
with ddeClientConv do
begin
ServiceApplication := sBrowerPrgFile;
SetLink( sServiceName,'WWW_GetWindowInfo');
StartPtr:= RequestData('0xFFFFFFFF');
end;
finally
ddeClientConv.Free;
end;

if startPtr^ = #0 then
exit;
{skip leading "}
inc(StartPtr);
EndPtr:= StartPtr;
{proceed to next "}
while (EndPtr^ <> '"') do
inc(EndPtr);
{terminate URL string}
EndPtr^:= #0;
result:= StartPtr;
{skip ","}
StartPtr:= EndPtr+3;
if Netscape then
inc(StartPtr,12);

EndPtr:= StartPtr;
if Netscape then
while (EndPtr^ <> ']') do
inc(EndPtr)
else
while (EndPtr^ <> '"') do
inc(EndPtr);

EndPtr^:= #0;
Title:= strPas(StartPtr);
end;
 
后退
顶部