[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Receive the document of a firefox MozillaWindowClass window

Posted on 2007-11-25
4
Medium Priority
?
2,695 Views
Last Modified: 2013-12-08
I do the following code to receive the document of an HTML window in Internet-Explorer and it works OK.
But when I do the same on the MozillaWindowClass from FireFox
I receive hr=0x80004005

The code is:
 MSHTML::IHTMLDocument2Ptr spDoc;

 // Explicitly load MSAA so we know if it's installed
 if(! hInstOle)
 {
 CoInitialize( NULL );
  hInstOle= ::LoadLibrary( _T("OLEACC.DLL") );
 }
 if ( (hInstOle == NULL) || ( hWnd == NULL ) )return 1;
 LRESULT lRes;
 UINT nMsg = ::RegisterWindowMessage( _T("WM_HTML_GETOBJECT") );
 ::SendMessageTimeout( hWnd, nMsg, 0L, 0L, SMTO_ABORTIFHUNG, 1000, (DWORD*)&lRes );
      
 LPFNOBJECTFROMLRESULT pfObjectFromLresult = (LPFNOBJECTFROMLRESULT)::GetProcAddress( hInstOle, _T("ObjectFromLresult") );
 if ( pfObjectFromLresult == NULL )return 2;
 HRESULT hr;
 hr = (*pfObjectFromLresult)( lRes, IID_IHTMLDocument2, 0, (void**)&spDoc );


0
Comment
Question by:VapiSoft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 49

Accepted Solution

by:
DanRollins earned 1500 total points
ID: 20392940
I have no experience in this area, but was asked to see what I could find out.

Firefox has its own DOM and it's not surprising if if the "accessibility hack" that works for IE fails for Firefox.  Here's an external forum post that claims they got something to work:

    Accessing an ISimpleDOMNode
    http://www.nabble.com/Accessing-an-ISimpleDOMNode-t792679.html

(most similar threads end with "please help! it still doesn't work!").

Here's the start of the mozilla wiki relevant to this topic.
   http://www.mozilla.org/access/windows/msaa-server

and a more direct link to the specifics:
  Accessibility/AT-Windows-API
   http://wiki.mozilla.org/Accessibility/AT-Windows-API#How_to_Find_the_Content_Window_and_Load_the_Document

I hope that helps!

-- Dan

Here's the apparently "functional" code from the firrst link (I did not test it):
if (windowType == "MozillaWindowClass") { 
    IAccessible *pAccessible; 
    HRESULT hr = AccessibleObjectFromWindow(hwnd, OBJID_CLIENT, 
IID_IAccessible,(void**)&pAccessible); 
    if (SUCCEEDED(hr) && pAccessible != NULL) { 
        std::cout << "succes accessing an iaccessible!\n"; 
 
        IServiceProvider *pServProv = NULL; 
        pAccessible->QueryInterface(IID_IServiceProvider, 
(void**)&pServProv); 
        if (pServProv) { 
            std::cout << "succes accessing an IServiceProvider!\n"; 
 
         ISimpleDOMDocument *pSimpleDOMNode; 
            const GUID refguid = {0x0c539790, 0x12e4, 0x11cf, 0xb6, 
0x61, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8}; 
            HRESULT hr = pServProv->QueryService(refguid, 
IID_ISimpleDOMNode, (void**)&pSimpleDOMNode); 
            if (SUCCEEDED(hr) && pSimpleDOMNode != NULL) { 
         std::cout << "succes accessing an ISimpleDOMNode!\n"; 
            } 
        }   
    } 
}

Open in new window

0
 

Author Comment

by:VapiSoft
ID: 20394167
I accepted the answer although it did not work for me.
I understand that it did not work for the guy that created it.
In any case, Iwork with MSHTML DOM for IE and I though that that Firefox supports it.
When I found out that they do not support it, it is too much work for me to support another DOM.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 20399842
>> I understand that it did not work for the guy that created it.

A later post in the same thread indicates that it worked after installin a newer version of FireFox.
=-=-=-=-=-=-=-=-=-=-=

I think that it goes without saying that to avoid cross-browser issues such as this, one alternative is to just pull the raw HTML from the server (rather than pulling the strings on an open instance of some browser).   Once you have the raw HTML, then you do whatever you want with it -- without worrying about the quirks of the browser -- which is really a rendering/display-oriented tool, anyway.
0
 

Author Comment

by:VapiSoft
ID: 20401163
This is an interesting point-of-view.
How do you "pool the raw HTML from the server (and make the browser show the chanhes)?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question