C# .net :: Is it possible to take BROWSER URL in run time when browser is open on screen

Viewed 36

Is is possible to take URL, Keywords, Meta Tag from browser in run time when browser is open.

I need to do below things

  1. if any application open then need to take application name, if this is desktop application then no need of browser details.

  2. Suppose any browser is open then need to collect below details

  3. Browser Name

  4. URL

  5. Title

  6. Keywords

  7. Description

  8. Meta Tag Below functions are working

    [DllImport("user32.dll")]
    static extern IntPtr GetForegroundWindow();
    [DllImport("user32.dll")]
    static extern int GetWindowText(IntPtr hwnd, StringBuilder ss, int count);
    

Another functions call in program

 private string ActiveWindowTitle()
    {
        //Create the variable
        const int nChar = 256;
        StringBuilder ss = new StringBuilder(nChar);

        //Run GetForeGroundWindows and get active window informations
        //assign them into handle pointer variable
        IntPtr handle = IntPtr.Zero;
        handle = GetForegroundWindow();

        if (GetWindowText(handle, ss, nChar) > 0) return ss.ToString();
        else return "";
    }
0 Answers
Related