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]>
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding