Hi Gangadhar,
Thanks for the help. I can confirm that all you have to do to have your
component registered is place the .dll and .xpt files in the mozilla
components folder (in my case "C:\Program
Files\mozilla.org\Mozilla\components") - If your then restart Mozilla
and take a look inside the compreg.dat and xpti.dat  files you'll see
references to you component and the categories, interfaces, etc. that
it's registered for.
You can then use component viewer to see your component in the list of
mozilla components.

However I think your wrong about your component being loaded by mozilla.
After I did all the above my component still wasn't being loaded. I
tested this by setting a breakpoint at the start of DllMain in my
component and attaching to Mozilla in the VS.Net debugger. My breakpoint
was never hit, indicating that my dll was not being loaded.
I then took a look at mozilla using process explorer as you did. With
process explorer it seemed to indicate that my dll was being accessed in
some way as my DLL was appearing in the list of DLLs. But the fact that
DllMain wasn't being hit when debugging indicated that it wasn't
actually being loaded. I had a read of the process explorer manual and
it says that a DLL will appear in the DLL list if it is loaded OR
opened. I then used another utility FileMon (file monitor) to check what
was happening to my DLL when Mozilla starts. With filemon it seemed to
indicate that the dll was being opened, but nothing else (thus why it
appears in process explorer).

So... At the moment I'm concluding that my dll is being opened by
mozilla, but not actually loaded. Maybe I (we ;-)) are missing something
in our dll that causes mozilla not to load the dll?
Any ideas?

>Even I faced this problem and after futile attempts to resolve it, I
let 
>the matter to rest.
Do you mean that you're trying to use ShouldLoad aswell but that it
isn't being called in the component you've developed?

Thanks,
 Damien


>But I must add that I was able to view the component in the xpcom 
>component viewer and my component was getting loaded [I confirmed this 
>using process explorer]. You might want to check by removing the 
>compreg.dat and xpti.dat [don't forget to back them up] and then 
>starting mozilla. See if the component is registerd. IIRC the xpti.dat 
>and the compreg.dat both do get updated if the component is in the
right 
>place (the componets directory). Please post your findings on this, so 
>that this can help someone else out there.
>thank you
>Gangadhar

Damien O'Brien wrote:
> Hi,
> I've built an XPCOM component that uses the nsIContentPolicy 
> interface.
> The nsIContentPolicy function I'm using is ShouldLoad (gets called
just 
> before a new page is rendered). I register my XPCOM component using 
> regxpcom as instructed in "Creating XPCOM Components", but for some 
> reason it doesn't seem to be working. In fact even though regxpcom
says 
> that it's registered successfully I'm not sure it is. When I use 
> Component Viewer in Mozilla my component doesn't appear in the list of

> registered components. Anyone got any ideas why it doesn't appear? I
use 
> regxpcom as follows; regxpcom -x "C:\gecko-sdk\bin" "C:\Program 
> Files\Common 
> Files\mozilla.org\GRE\1.7.6_2005031907\components\TestPageLoad.dll"
> 
> Am I putting my dll in the right place?
> 
> If I take a look at compreg.dat I can see it's been updated with 
> details
> of my component and the interfaces  being used by my component.
xpti.dat 
> is also touched but it doesn't seem to have been updated in any way
(as 
> far as I can tell). So as I say my code doesn't seem to be getting 
> called when Mozilla starts and and I can't see my component in
component 
> viewer.
> 
> Also, should have mentioned that my component is registered as an
> xpcom-startup observer so that it gets loaded when XPCOM is loaded
(done 
> this using the sample code in "Creating XPCOM Components").
> 
> Any help greatly appreciated.
> 
> Thanks,
>  Damo
> 
_______________________________________________
Mozilla-xpcom mailing list
[email protected] http://mail.mozilla.org/listinfo/mozilla-xpcom

_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to