thanks for the pointer to the sdk - that gave me a good start.

i started putting together a simple console based app - with a view to
eventually extending it to render a page to a memory context - but i
ran out of steam - it was just too frustrating.

could you or someone point me to what other calls i need to implement
render to memory now that i seem to have everthing initialized okay.

my code is below which appears to initialize everything okay.

----------------- snip -----------------
#define MOZILLA_STRICT_API

#include "nsembedapi.h"
#include "nsxpcom.h"
#include "nscomptr.h"
#include "nsembedstring.h"
#include "nsiwebbrowser.h"
#include "nsiservicemanager.h"

#include <stdio.h>

int main ( int argc, char* argv [] )
{
    nsresult result;

    nsCOMPtr < nsILocalFile > file;
    result = NS_NewLocalFile ( nsEmbedString (
L"C:\\research\\mozilla" ), PR_FALSE, getter_AddRefs ( file ) );
    if ( NS_FAILED ( result ) )
    {
        printf ( "NS_NewLocalFile failed [%0.8x]\n", result );
        return 1;
    }

    result = NS_InitEmbedding ( file, 0 );
    if ( NS_FAILED ( result ) )
    {
        printf ( "NS_InitEmbedding failed [%0.8x]\n", result );
        return 1;
    }

    nsCOMPtr < nsIServiceManager > svcMgr;
    result = NS_GetServiceManager ( getter_AddRefs ( svcMgr ) );
    if ( NS_FAILED ( result ) )
    {
        printf ( "NS_GetServiceManager failed [%0.8x]\n", result );
        return 1;
    }

    nsCOMPtr < nsIWebBrowser > webBrowser;
    result = svcMgr->GetServiceByContractID (
"@mozilla.org/embedding/browser/nsWebBrowser;1", NS_GET_IID (
nsIWebBrowser ), getter_AddRefs ( webBrowser ) );
    if ( NS_FAILED ( result ) )
    {
        printf ( "GetServiceByContractID failed [%0.8x]\n", result );
        return 1;
    }

    // now what.....  
    //  if only....
//    unsigned char memoryContext = new unsigned char [ 256 * 256 * 3
];
//    webBrowser->setTargetFormat ( RGB );
//    webBrowser->setTarget ( memoryContext );
//    webBrowser->browseTo ( "http://google.com"; );
//    
//


    result = NS_TermEmbedding ();
    if ( NS_FAILED ( result ) )
    {
        printf ( "NS_TermEmbedding failed [%0.8x]\n", result );
        return 1;
    }
}
----------------------------------------
_______________________________________________
mozilla-embedding mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to