Re: Embedding basics

"[email protected]" <[email protected]> Mon, 07 Nov 2011 14:56:20 +0000
Newsgroups gmane.comp.mozilla.devel.embedding
Organization NovaDSP
Message-ID <[email protected]>
Hi Sunil

How 'headless' does it need to be? And for which OS?

On 07/11/2011 13:37, Sunil Kumar wrote:
> Is there any documentation for 'offscreen' branch?
>
> On Mon, Nov 7, 2011 at 7:05 PM, Sunil Kumar<[email protected]>  wrote:
>
>> I wish it was there.
>> I could not find any proper documentation for this.
>> This code is taken from bits of codes from many projects.
>>
>> On Mon, Nov 7, 2011 at 6:46 PM, Glen Gray<[email protected]>  wrote:
>>
>>> Is there an online how-to/tutorial for using the below methods ?
>>>
>>>
>>> On 3 Nov 2011, at 13:12, Sunil Kumar wrote:
>>>
>>>> I need to know what all I need to do and in Which order to load a URL in
>>>> nsWebBrowser instance.
>>>>
>>>> In reality I get NS_ERROR_UNEXPECTED(0x8000FFFF) when I run following
>>> code.
>>>>
>>>> <code>
>>>> #include<iostream>
>>>> #include<xpcom-config.h>
>>>> #include<nsXPCOMGlue.h>
>>>> #include<nsXPCOM.h>
>>>> #include<nsCOMPtr.h>
>>>> #include<nsStringAPI.h>
>>>> #include<nsEmbedString.h>
>>>> #include<nsILocalFile.h>
>>>> #include<nsIWebBrowser.h>
>>>> #include<nsCWebBrowser.h>
>>>> #include<nsIWebNavigation.h>
>>>> #include<nsComponentManagerUtils.h>
>>>> #include<nsServiceManagerUtils.h>
>>>>
>>>> using namespace std;
>>>>
>>>> int main()
>>>> {
>>>> nsresult rv;
>>>> nsCOMPtr<nsILocalFile>  bin_dir;
>>>> rv = NS_NewLocalFile(nsEmbedString(L"C:\\xulrunner-sdk\\bin"), PR_FALSE,
>>>> getter_AddRefs(bin_dir));
>>>> if(NS_FAILED(rv))
>>>> {
>>>> cout<<"Failed for file. rv="<<rv<<endl;
>>>> exit(-1);
>>>> }
>>>> printf("Initializing\n");
>>>>
>>>> nsCOMPtr<nsIServiceManager>  sm;
>>>> rv = NS_InitXPCOM2(getter_AddRefs(sm), bin_dir, nsnull);
>>>> if(NS_FAILED(rv))
>>>> {
>>>> cout<<"Failed INIT. rv="<<rv<<endl;
>>>> exit(-2);
>>>> }
>>>>
>>>> printf("Creating Browser components\n");
>>>> nsCOMPtr<nsIWebBrowser>  nsBrowser;
>>>> nsBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID,&rv);
>>>> if(NS_FAILED(rv))
>>>> cout<<"Failed to create Browser, rv:"<<rv<<endl;
>>>>
>>>> nsCOMPtr<nsIWebNavigation>  nsWebNav;
>>>> nsWebNav = do_QueryInterface(nsBrowser,&rv);
>>>> if(NS_FAILED(rv))
>>>> cout<<"Failed to create WebNav, Code:"<<rv<<endl;
>>>>
>>>> char* uri = "http://www.google.com";
>>>> rv = nsWebNav->LoadURI((const PRUnichar *)uri,
>>>> nsIWebNavigation::LOAD_FLAGS_NONE, nsnull, nsnull, nsnull);
>>>> if(NS_FAILED(rv))
>>>> cout<<"Failed to load URI, rv:"<<rv<<endl;
>>>> else
>>>> cout<<"URI Loaded. HoooLaalaa\n";
>>>>
>>>> cout<<"Shutting Down\n";
>>>> NS_ShutdownXPCOM(nsnull);
>>>> cout<<"Done...\n";
>>>> //getchar();
>>>> return rv;
>>>> }
>>>> </code>
>>>>
>>>> Any help with this? Please.
>>>> --
>>>> Your smile is the most precious thing that doesn't cost you. Keep
>>> smiling.
>>>> :)
>>>> ===============
>>>>      SunilKumar
>>>> ------------------------------
>>>> http://in.linkedin.com/in/sunilkr86/
>>>> ===============
>>>> _______________________________________________
>>>> dev-embedding mailing list
>>>> [email protected]
>>>> https://lists.mozilla.org/listinfo/dev-embedding
>>>
>>> --
>>> Glen Gray
>>> <[email protected]>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>> --
>> Your smile is the most precious thing that doesn't cost you. Keep smiling.
>> :)
>> ===============
>>       SunilKumar
>> ------------------------------
>> http://in.linkedin.com/in/sunilkr86/
>> ===============
>>
>>
>
>