how to implement nsIWepProgressListener in C++
Christian Sell <[email protected]> Thu, 20 Feb 2014 09:33:49 -0800 (PST)
| Newsgroups | gmane.comp.mozilla.devel.embedding |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I have the following class declaration:
class MyLocationListener: public nsIWebProgressListener
{
public:
MyLocationListener();
virtual ~MyLocationListener();
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBPROGRESSLISTENER
};
and the corresponding implementation. I am using this class in the following way:
MyLocationListener * listener = new MyLocationListener();
nsCOMPtr<nsIWeakReference> weakref = do_GetWeakReference(listener, &retval);
CHECKERR();
retval = browser->AddWebBrowserListener(weakref, NS_GET_IID(nsIWebProgressListener));
CHECKERR();
however, the do_GetWeakReference call fails with an NS_ERROR_NO_INTERFACE error code. Can someone point out to me how to fix that? I tried to add a nsIWeakReference superclass to the class decl, including the NS_DECL_xx macros, but that yielded compile errors that I was notable to decipher. Maybe someone has a quick hint, or link..
TIA,
Christian