现在的位置: 首页 > 综合 > 正文

从当前的浏览器取得当前URL

2013年06月22日 ⁄ 综合 ⁄ 共 614字 ⁄ 字号 评论关闭

 

   确定在uses子句中增加DDEMan。

uses windows, ddeman, ......

function Get_URL(Servicio: string): String;
var
   Cliente_DDE: TDDEClientConv;
   temp:PChar; file://<<----------------这是新的
begin
    Result := '';
    Cliente_DDE:= TDDEClientConv.Create( nil );
     with Cliente_DDE do
        begin
           SetLink( Servicio,'WWW_GetWindowInfo');
           temp := RequestData('0xFFFFFFFF');
           Result := StrPas(temp);
           StrDispose(temp); file://避免内存漏洞
           CloseLink;
        end;
      Cliente_DDE.Free;
end;

procedure TForm1.Button1Click(Sender);
begin
   showmessage(Get_URL('Netscape'));
      or
   showmessage(Get_URL('IExplore'));
end;

抱歉!评论已关闭.