Christian Biesinger <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> On Tue, Jul 13, 2004 at 11:40:42AM +0100, Neil wrote:
> > I can't tell you where you would get a document loader from.
> 
> http://lxr.mozilla.org/seamonkey/source/uriloader/base/nsCURILoader.idl#68
> (use do_GetService)
> 
> --

Hi,

Thanks for the answers.

I have implement the suggestion in the following code, but, I am still
not able to capture any browser signal yet.  May I know if there is
anything I missed out in the following code in order to start
receiving Mozilla browser event?

I have no compilation error.  The following is a summary of my code:

HEADER:
--------------
class myListener : public nsIWebProgressListener,
                    public nsSupportsWeakReference
{
public:
    myListener();
    ~myListener();
    NS_DECL_ISUPPORTS
    NS_DECL_NSIWEBPROGRESSLISTENER
};

class nsSampleImpl : public nsISample
{
public:
    nsSampleImpl();
.........
};

///////////////////////////////////////////////////////////////////////////////////////////////////////////

CPP:
--------

static NS_DEFINE_IID(kDocLoaderServiceCID, NS_URI_LOADER_CID);

myListener::myListener()
{
    // Register as an observer for the document loader  
    nsCOMPtr<nsIWebProgress>
progress(do_GetService(kDocLoaderServiceCID));

    if (progress)
        progress->AddProgressListener(this,
nsIWebProgress::NOTIFY_ALL);
    else
       printf("myListener(): error->progress is null.");
}

........

NS_IMETHODIMP
myListener::OnStateChange(nsIWebProgress* aWebProgress,
                          nsIRequest *aRequest,
                          PRUint32 progressStateFlags,
                          nsresult aStatus)
{
............
}

nsSampleImpl::nsSampleImpl()
{
    printf("nsSampleImpl() enter.\n");

    mListener = nsnull;
    mListener =  new myListener();

    printf("nsSampleImpl() exit.\n");
}
.............

yueweng
_______________________________________________
mozilla-embedding mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to