Hi all,

I'm modifying mfcembed to run outside of the GRE directory by specifying a customized GRE directory. In specific, I'm modifying the CMfcEmbedApp::InitInstance() code:
http://lxr.mozilla.org/mozilla/source/embedding/tests/mfcembed/MfcEmbed.cpp#383

Below is the new initialization code. I verified that for mozilla 1.8a3, while specifying the GRE directory (greDirPath) to either the unzipped directory (.zip package) and the created GRE directory (.exe package), mfcembed.exe works. But for 1.7 or 1.6, mfcembed works only if specifying the GRE directory to the unzipped directory, but doesn't work if specifying the created GRE directory, which fails in below code. Though there is no returned error code,  there is no page http://www.mozilla.org loaded. Could anybody give any hints to debug it ? Any changes in 1.8a3 to make it work ?

// From MfcEmbed.cpp
>>>        CBrowserFrame *pBrowserFrame = CreateNewBrowserFrame(nsIWebBrowserChrome::CHROME_ALL);
>>>        m_pMainWnd = pBrowserFrame;
>>>        pBrowserFrame->m_wndBrowserView.OpenURL("http://www.mozilla.org");

--- snip ---
BOOL CMfcEmbedApp::InitInstance()
{
......
    TCHAR xpcomFilePath[_MAX_PATH+1];
    TCHAR greDirPath[_MAX_PATH+1];

    // mfcembed.exe works !!!
    //strcpy(xpcomPath, "D:\\mozilla.org\\mozilla-win32-1.7\\mozilla\\xpcom.dll");
    //strcpy(greDirPath, "D:\\mozilla.org\\mozilla-win32-1.7\\mozilla");

    // mfcembed.exe works !!!
    //strcpy(greDirPath, "C:\\Program Files\\Common Files\\mozilla.org\\GRE\\1.8a3_2004081709\\xpcom.dll");
    //strcpy(greDirPath, "C:\\Program Files\\Common Files\\mozilla.org\\GRE\\1.8a3_2004081709");

    // mfcembed.exe doesn't work ???
    strcpy(greDirPath, "C:\\Program Files\\Common Files\\mozilla.org\\GRE\\1.7_2004061609\\xpcom.dll");
    strcpy(greDirPath, "C:\\Program Files\\Common Files\\mozilla.org\\GRE\\1.7_2004061609");

    nsCOMPtr<nsILocalFile> greDir;
    rv = NS_NewNativeLocalFile(nsEmbedCString(T2A(greDirPath)), TRUE, getter_AddRefs(greDir));
    if (NS_FAILED(rv)) {
        ReportError("NS_NewNativeLocalFile failed!");
        return FALSE;
    }

#ifdef XPCOM_GLUE
    rv = XPCOMGlueStartup(xpcomFilePath);
    if (NS_FAILED(rv)) {
        ReportError("XPCOMGlueStartup failed!");
        return FALSE;
    }

    rv = NS_InitXPCOM2(nsnull, greDir, nsnull);
    if (NS_FAILED(rv)) {
        ReportError("NS_InitXPCOM2 failed!");
        return FALSE;
    }
#else
    NS_InitEmbedding(greDir, nsnull);
#endif

    rv = OverrideComponents();
......
--- snip ---

Any comments are much appreciated !

-George.

Reply via email to