Parse Chrome window similar to IHTMLDocument2

154 views Asked by At

Using the code posted below Ican get the window handle of a Internet Explorer window and transform it into a IHTMLDocument2 object to read the html. Is there anything similar that can be used for Chrome windows besides enabling remote debugging?

        IHTMLDocument2 document = null;
        int lRes;
        Trace.WriteLine("About to GetWindowHandleByTitle");
        var hWnd = GetWindowHandleByTitle();
        Trace.WriteLine("About to GetWindowHandleByTitle Complete");
        EnumProc proc = EnumWindows;
        EnumChildWindows(hWnd, proc, ref hWnd);
        Trace.WriteLine("Found Child Window");

        if (hWnd.Equals(IntPtr.Zero))
        {
            return null;
        }

        int lngMsg = RegisterWindowMessage("WM_HTML_GETOBJECT");

        if (lngMsg == 0)
        {
            return null;
        }

        SendMessageTimeout(hWnd, lngMsg, 0, 0, SMTO_ABORTIFHUNG, 1000, out lRes);

        if (lRes == 0)
        {
            return null;
        }

        ObjectFromLresult(lRes, ref IID_IHTMLDocument, 0, ref document);
0

There are 0 answers