On Thursday 02 August 2007, callum wrote:

Hi,

> Does anyone have some C++ code they could share that shows me how
> complete the missing piece?
> (I'm using the 1.8.1 branch)
Here I have a java code doing that. Should be straightforward
translating it to back c++ ;-)

nsIServiceManager sm = Mozilla.getInstance().getServiceManager();
nsIComponentRegistrar cr = Mozilla.getInstance().getComponentRegistrar();
nsIFactory myfactory = new MyPromptServiceFactory();
cr.registerFactory(MY_IMPLEMENTATION_CID, "My Prompt Service",
                                "@mozilla.org/embedcomp/prompt-service;1",
                                myfactory);

private class MyPromptServiceFactory implements nsIFactory {
  public PromptServiceFactory() {}
  public nsISupports createInstance(nsISupports anOuter, String iid) {
     return new MyPromptService();
  }
  public void lockFactory(boolean lock) {}
  public nsISupports queryInterface(String iid) {
    return Mozilla.queryInterface(this, iid);
  }
}

best regards,
Michal

> I want to override the nsIPromptService so I can replace the various
> prompts with my own versions. I've added the relevant impl's but I
> don't know how to tell the browser to use mine instead of its own.
>
> Does anyone have some C++ code they could share that shows me how
> complete the missing piece?
> (I'm using the 1.8.1 branch)
>
> --Cal
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to