Hi All,

I am trying to implement XPCOM for Netscape 6.2, using the XPCOM.DLL
using "C".
I don't want to use anything else then "C". Following is my
requirement that we have implemented for IE Browser:

1. DeskBand for Netscape (Is this possible for NETSCAPE. As We have
done it for IE, If yes, how and what type of application has to be
written?)

2. After a person surf's a site he may click on the DeskBand button
which will invoke a application, this application quiries for the
view-source of the current site. Then the application will search for
some tags and will process furthur. This works for IE.

My basic requirement is to grab the source of the Netscape current
window "view-source". I have tried the following thru a console App.
This app is nothing but the sample from Mozilla source "APITest.cpp"
with minor changes.

I have build Mozilla successfully and tried the following application
on the XPCOM.DLL of the mozilla build.

This application fails for the Netscape XPCOM.DLL 
with the Error => 
"The apitest.exe file is linked to missing export
XPCOM.DLL:NS_InitXPCOM2."

====================================
char *pszBinDirPath = nsnull;

        nsresult  nsResult;
        nsresult rv;
        
        printf("apitest running...\n");
        if (argc > 1)
        {
                pszBinDirPath = argv[1];
        }
        
        
        nsCOMPtr<nsILocalFile> binDir;
        NS_ConvertASCIItoUCS2 strPath(pszBinDirPath);
        rv = NS_NewLocalFile(strPath, PR_TRUE, getter_AddRefs(binDir));
        if (NS_FAILED(rv))
        {
                printf("NS_NewLocalFile FAILED (rv = 0x%08x)\n", rv);
                // DROP THROUGH - NS_TermEmbedding should cope
        }
    else
    {
        printf("NS_NewLocalFile SUCCEEDED (rv = 0x%08x)\n", rv);
    }
        rv = NS_InitEmbedding(binDir, nsnull);
        if (NS_FAILED(rv))
        {
                printf("NS_InitEmbedding FAILED (rv = 0x%08x)\n", rv);
                // DROP THROUGH - NS_TermEmbedding should cope
        }
    else
    {
        printf("NS_InitEmbedding SUCCEEDED (rv = 0x%08x)\n", rv);
    }
        nsCOMPtr<nsIWebBrowser> pBrowser2 
        (do_GetService("@mozilla.org/embedding/browser/nsWebBrowser;1"));
        if (pBrowser2 == 0) 
          printf("%s:%d mediator:0x%p",__FILE__,__LINE__,pBrowser2);
        else 
          printf("%s:%d mediator:0x%p\n",__FILE__,__LINE__,pBrowser2);
        
        nsCOMPtr<nsIWindowMediator> mediator=0;
       mediator = do_GetService(NS_RDF_DATASOURCE_CONTRACTID_PREFIX
"window-mediator");
        if (mediator == 0) 
                printf("%s:%d mediator:0x%p",__FILE__,__LINE__,mediator);
        else 
                printf("%s:%d mediator:0x%p\n",__FILE__,__LINE__,mediator);
        
        nsCOMPtr<nsIDOMWindowInternal> window=0;
    nsResult = mediator->GetMostRecentWindow(nsnull,getter_AddRefs(window));
        // <---------------- Fails: window is always 0
    if (NS_FAILED(nsResult) || (window==0)) 
                printf("%s:%d window:0x%p  
nsResult:%x",__FILE__,__LINE__,window,nsResult);
        else
                printf("%s:%d   window:0x%p 
nsResult:%x\n",__FILE__,__LINE__,window,nsResult);

        rv = NS_TermEmbedding();
        if (NS_FAILED(rv))
        {
                printf("NS_TermEmbedding FAILED (rv = 0x%08x)\n", rv);
                // DROP THROUGH
        }
    else
    {
        printf("NS_TermEmbedding SUCCEEDED (rv = 0x%08x)\n", rv);
    }

        // TODO more interesting stuff. Time to shutdown

    // Dump the leaked memory
    printf("FINAL LEAKAGE:\n");
    printf("apitest complete\n");
==============================

this test app fails for Mozilla at

nsCOMPtr<nsIDOMWindowInternal> window=0;
    nsResult = mediator->GetMostRecentWindow(nsnull,getter_AddRefs(window));
        // <---------------- Fails: window is always 0

It totally fails for Netscape XPCOM.DLL. as mentioned above.

Please help me out in a correct direction so as to fulfill my
requirement.

I don't know what type of application has to be written for Netscape.
whether this is possible for Netscape or not?


I highly appreciate all the help you GURU's do.

I am stuck at a very critical stage as this may affect my JOB... and
deporately require a helping hand...

Thanx,

Nitin Dangare

Reply via email to