Mar 26, 2011 at 6:14am UTC
Hi. Why I can't create an instance of this interface implementation?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
class CExplorerBrowserEvents : public IExplorerBrowserEvents
{
public :
CExplorerBrowserEvents();
~CExplorerBrowserEvents();
virtual HRESULT __stdcall QueryInterface (REFIID iid, void ** ppvObject);
virtual ULONG __stdcall AddRef (void );
virtual ULONG __stdcall Release (void );
virtual HRESULT __stdcall OnNavigationComplete(PCIDLIST_ABSOLUTE pidlFolder);
virtual HRESULT __stdcall OnNavigationFailed(PCIDLIST_ABSOLUTE pidlFolder);
virtual HRESULT __stdcall OnNavigationPending(PCIDLIST_ABSOLUTE pidlFolder);
virtual HRESULT __stdcall OnViewCreated(IShellView *psv);
private :
;
};
CExplorerBrowserEvents::CExplorerBrowserEvents()
{
;
}
CExplorerBrowserEvents::~CExplorerBrowserEvents()
{
;
}
HRESULT __stdcall CExplorerBrowserEvents::QueryInterface (REFIID iid, void ** ppvObject)
{
if (iid == IID_IUnknown)
{
AddRef();
*ppvObject = this ;
return S_OK;
}
else
{
*ppvObject = 0;
return E_NOINTERFACE;
}
}
ULONG __stdcall CExplorerBrowserEvents::AddRef(void )
{
return 1;
}
ULONG __stdcall CExplorerBrowserEvents::Release(void )
{
return 1;
}
HRESULT __stdcall CExplorerBrowserEvents::OnNavigationComplete(PCIDLIST_ABSOLUTE pidlFolder)
{
return E_NOTIMPL;
}
HRESULT __stdcall CExplorerBrowserEvents::OnNavigationFailed(PCIDLIST_ABSOLUTE pidlFolder)
{
return E_NOTIMPL;
}
HRESULT __stdcall CExplorerBrowserEvents::OnNavigationPending(PCIDLIST_ABSOLUTE pidlFolder)
{
return E_NOTIMPL;
}
HRESULT __stdcall CExplorerBrowserEvents::OnViewCreated(IShellView *psv)
{
return E_NOTIMPL;
}
when I try to create an instance I get:
[Error] cannot construct an abstract class
CExplorerBrowserEvents *events = new CExplorerBrowserEvents; // <------ here
How can I solve this problem?
Last edited on Mar 26, 2011 at 6:16am UTC
Mar 26, 2011 at 7:35am UTC
I just tried the code you posted and I didn't get that error.
Mar 26, 2011 at 9:26am UTC
Maybe this is an Open Watcom mistake then. I will try using a different compiler, but I can't use Visual C++ 2010 Express, cuz I need the CLSID_ExplorerBrowser in the same example.
I can link an example with CLSID_ExplorerBrowser in Open Watcom, but I can't in Visual Express.
Thank you for the answer.
Last edited on Mar 26, 2011 at 9:27am UTC
Mar 26, 2011 at 10:45am UTC
I have to correct myself... I finally got it in VExpress and will have to use this compiler for a while.
Ty again.
Last edited on Mar 26, 2011 at 10:46am UTC