How can I get the URL from a running instance of Chrome using Delphi?
I am trying to make a Delphi application that gets the URL of the active browser tab (IE, Mozilla, etc.). I use this code that works for IE:
procedure TForm1.GetCurrentURL (var URL, Title : string); var DDEClient : TDDEClientConv; s : string; begin s := ''; try DDEClient := TDDEClientConv.Create(self); with DDEClient do begin if SetLink('IExplore','WWW_GetWindowInfo') then s := RequestData('0xFFFFFFFF,sURL,sTitle') else if SetLink('Netscape','WWW_GetWindowInfo') then s := RequestData('0xFFFFFFFF,sURL,sTitle') else if SetLink('Mosaic','WWW_GetWindowInfo') then s := RequestData('0xFFFFFFFF,sURL,sTitle') else if SetLink('Netscp6','WWW_GetWindowInfo') then s := RequestData('0xFFFFFFFF,sURL,sTitle') else if SetLink('Mozilla','WWW_GetWindowInfo') then s := RequestData('0xFFFFFFFF,sURL,sTitle') else if SetLink('Firefox','WWW_GetWindowInfo') then s := RequestData('0xFFFFFFFF,sURL,sTitle'); end; if s <> '' then begin delete(s,1,1); URL := copy(s,1,pos('","',s)-1); delete(s,1,pos('","',s)+2); Title := copy(s,1,pos('"',s) - 1); end; exit; except MessageDlg('URL attempt failed!',mtError,[mbOK],0); end; end;
But this code does not work with Chrome.
Thanks.
delphi
razonasistemas
source share