Click here to Skip to main content
12,953,666 members (50,747 online)
Rate this:
 
Please Sign up or sign in to vote.
Google Chrome places each tab into a separate process. Only the currently selected tab has it's Process.MainWindowTitle set to the current tab's title. The other tab's do not contain this information.

Is there a way to find out the Title of each tabs from the processes?
Posted 1-Jul-11 20:16pm
rus204711
Comments
TcJoshJohnson 2-Jun-14 13:46pm
   
If I'm not mistaken, I think all tabs reside in the main UI process. Chrome spins up a new process to render the content of each tab and updates the UI through IPC. This was my understanding of the architecture anyway.
Member 11888574 5-Aug-15 15:12pm
   
How we can get this process
Code projects an earn from it
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 6

using System;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
 
namespace Demo
{
    [SuppressUnmanagedCodeSecurity]
    internal static class UnsafeNativeMethods
    {
        //get title of the window
 
        #region Delegates
 
        public delegate bool EnumWindowProc(IntPtr hWnd, IntPtr parameter);
 
        #endregion
 
        [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
        internal static extern int GetWindowText(IntPtr hWnd, [Out] StringBuilder lpString, int nMaxCount);
 
        //find the window handler.
        [DllImport("user32.dll", SetLastError = true)]
        internal static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
 
        //hide the window.
        [DllImport("user32.dll")]
        internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
 
        //To get child window
        [DllImport("user32", CharSet = CharSet.Auto, SetLastError = true)]
        public static extern IntPtr GetWindow(IntPtr hwnd, int wFlag);
 
        //To get child window
        [DllImport("user32")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EnumChildWindows(IntPtr window, EnumWindowProc callback, IntPtr i);
    }
}
  Permalink  
Comments
Amey K Bhatkar 21-Jul-14 3:37am
   
let me know if you want description.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You can enumerate all windows of the process and determine the main window (the main window usually has WS_CAPTION, WS_SYSMENU and other special styles). Then call GetWindowText() for that window to get its title.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 5

try this, hope it works..


Process[] processes = Process.GetProcessesByName("chrome");
string name = processes[i].MainWindowTitle;
  Permalink  
Comments
Valery Possoz 21-Jun-14 6:01am
   
That does not work... only the active tab has it's MainWindowTitle set. All the other processes have an empty window title.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 7

I am not 100% sure if this is what you are looking for but I used it a couple of times.
http://stackoverflow.com/questions/16958051/get-chrome-browser-title-using-c-sharp
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 8

Process[] p = Process.GetProcessesByName("chrome");
foreach (Process item in p)
{
   MessageBox.Show(item.MainWindowTitle);
}


Try like this ?
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
ppolymorphe 2,020
Jochen Arndt 1,975


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 23 Oct 2014
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100