Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4052202
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:17:26+00:00 2026-05-20T14:17:26+00:00

How can I get the url from a running instance of Chrome using Delphi?

  • 0

How can I get the url from a running instance of Chrome using Delphi?

I’m trying to do a Delphi application that gets the url of the active tab of the browser (IE, Mozilla, etc.). I’m using 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 doesn’t work with Chrome.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:17:26+00:00Added an answer on May 20, 2026 at 2:17 pm

    Here is how I have done it before for retrieving the URL from the active tab. You could probably extend this to include all of Chrome’s tabs.

    One other note, as you can see this grabs the first handle to chrome.exe that it finds. To have this accommodate multiple instances of Chrome running, you would need to adjust this to get a handle to each Chrome instance.

    I put this together pretty quick, so don’t consider this “production” quality. Just create a new vcl application and drop a TMemo and a TButton on the form and assign the Button1Click to TButton’s OnClick event.

    unit main;
    
    interface
    
    uses
      Windows,
      Messages,
      SysUtils,
      Classes,
      Controls,
      Forms,
      StdCtrls;
    
    type
      TForm1 = class(TForm)
        Memo1: TMemo;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    function GetActivePageUrlFromChrome(Handle: HWnd; Param: LParam): Bool; stdcall;
    
    var
      Form1             : TForm1;
    
    implementation
    
    {$R *.dfm}
    
    function GetActivePageUrlFromChrome(Handle: HWnd; Param: LParam): Bool; stdcall;
    var
      List: TStrings;
      hWndChrome, hWndChromeChild: HWND;
      Buffer            : array[0..255] of Char;
    begin
      List := TStrings(Param);
      //get the window caption
      SendMessage(Handle, WM_GETTEXT, Length(Buffer), integer(@Buffer[0]));
      //look for the chrome window with "Buffer" caption
      hWndChrome := FindWindow('Chrome_WidgetWin_0', Buffer);
      if hWndChrome <> 0 then
      begin
        hWndChromeChild := FindWindowEx(hWndChrome, 0, 'Chrome_AutocompleteEditView', nil);
        if hWndChromeChild <> 0 then
        begin
          SendMessage(hWndChromeChild, WM_GETTEXT, Length(Buffer), integer(@Buffer));
          List.Add(Buffer);
        end;
      end;
      Result := True;
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      slChromeUrl      : TStringList;
    begin
      slChromeUrl := TStringList.Create;
      try
        EnumWindows(GetActivePageUrlFromChrome, LParam(slChromeUrl));
        Memo1.Lines.AddStrings(slChromeUrl);
      finally
        FreeAndNil(slChromeUrl);
      end;
    end;
    
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.