Start New Discussion within our Software Development Community

Hi Experts,

I would like to seek your help, I need to create an application which can extract the current Active Tab and URL of any browser (i.e Chrome, IE, FireFox). I had googled around but there no samples had satisfy my needs.

Sample:

I would like to get the URL of active tab of Chrome and this code will get the current process of Chrome:

    Private Function GetURL() as string 
        Dim proc As System.Diagnostics.Process = GetBrowser("chrome")
        return GetURL
    End Sub

From this code, how can I know if what was the active tab of the browser?

    Private Function GetBrowser(BrowserName as string) as System.Diagnostics.Process
        Dim pList() As System.Diagnostics.Process = System.Diagnostics.Process.GetProcessesByName(BrowserName)
        For Each proc As System.Diagnostics.Process In pList
            If proc.ProcessName = appName Then
                If proc.MainWindowHandle.ToInt32 > 0 Then Return proc
            End If
        Next
    End Function

From this code, how can i extract the activebrowser URL?

    private Function GetURL(ActiveBrowser as System.Diagnostics.Process) as string
         'What to code?
    End Function

Hoping there would somebody out there who can help me on this.

Thank you and more power.

This question has already been answered. Start a new discussion instead.