I finally got the mozilla test application "winEmbed" to work by hardcoding the GRE directory to mozilla/dist/bin/. I also had to turn of default unicode compile settings in vc8 and link to string_s.lib.
The main difference between my previous code and the working sample is the initialization. The sample does runtime DLL loading, XPCOM initialization, XUL initialization, GRE initialization and XRE initialization. Phew, talk about making things complicated... is this really how it is meant to work? Another thing to observe as a newcommer. There are several web pages and documents describing other methods of initialization that do not work. It is a bit confusing for a beginner to find a lot of seemingly correct information that does not work. Anyway, this solved my problem because now I have a working embeding example! peace /Emil "Emil Wikström" <[EMAIL PROTECTED]> skrev i meddelandet news:[EMAIL PROTECTED] > Dear experts, > > I am trying to embed the Mozilla parser in my WIN32 C++ application, but > now I am stuck. > > First I tried using the XULRunner SDK. According to the documentation you > should use the nsIWebNavigation interface to control the browser instance > which is strange since this interface is not part of the SDK. How can I > control the browser without either nsIWebNavigation nor nsIDocShell? I > guess they are not part of the SDK because they are not frozen, but how > can I then use the SDK? > > When I did not find a solution using the XULRunner package I decided to > download and build the whole Mozilla tree. Then I could use the non frozen > APIs. However when trying to load an URL I get "Out of memory" error... > > Here is the key points of what my app does: > > 1. Create native window > hwnd = CreateWindow(wclassname, wclassname, WS_OVERLAPPEDWINDOW, > 0,0,800,600,NULL,NULL,hInstance,NULL); > > 2. Initialize XPCOM > rv = NS_InitXPCOM2(nsnull, nsnull, nsnull); > I have also tried rv = NS_InitEmbedding(nsnull, nsnull); > > 3. Create mozilla browser > webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv); > > 4. Get navigation interface > webNav = do_QueryInterface( webBrowser, &rv ); > > 5. Set chrome that handles required interfaces: > nsIEmbeddingSiteWindow/nsIWebBrowserChrome/nsIWebProgressListener > rv = webBrowser->SetContainerWindow(chrome); > > 6. Tell browser about the chrome type > setup = do_QueryInterface(webBrowser, &rv); > setup->SetProperty(nsIWebBrowserSetup::SETUP_IS_CHROME_WRAPPER, PR_TRUE); > > 7. Create the browser window > baseWindow = do_QueryInterface( webBrowser, &rv ); > rv = baseWindow->InitWindow(nsNativeWidget(hwnd), nsnull, 0,0,800,600); > rv = baseWindow->Create(); > > 8. Set up progress listener > webBrowser->AddWebBrowserListener(weakRefToChrome, > NS_GET_IID(nsIWebProgressListener)); > > 9. Make browser visible > rv = baseWindow->SetVisibility(PR_TRUE); > > 10. Load URL > rv = webNav->LoadURI(uri, nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, > nsnull, nsnull); > > At this point I receive an Out of memory error (8007000e) > > What am I missing? > Maybe some compile configurations? > Maybe something in the initialization? > > Any help is greatly appreciated > > /Emil Wikström > > PS. The purpose of the application is to analyze the DOM of DHTML web > pages (spider/scraper) > PPS. This is a C++ app so XULRunner/Javascript runtime scripting is not an > option > PPPS. Ultimately this should be a service/daemon so I want to get rid of > the GUI at some point > _______________________________________________ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
