yaniv_av
May 31st, 2009, 08:43 AM
Hi,
I'm trying to implement my own ITextDocument derived class.
In the first step, I only try to inherit my class from ITextDocument, and implement all its function with "return E_NOTIMPL".
For some reason, when I'm trying to create an instance of my derived class, I get an error "cannot instantiate abstract class" - Althought I implemented all the functions, including the IUnknown+IDispatch interdaces functions.
Here is my code:
#ifndef __cplusplus
#define __cplusplus
#endif
#ifdef CINTERFACE
#undef CINTERFACE
#endif
#include "tom.h"
struct CTextDocumentMutation : public ITextDocument
{
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void *ppvObject){return E_NOTIMPL;}
virtual ULONG STDMETHODCALLTYPE AddRef(void) {return E_NOTIMPL;}
virtual ULONG STDMETHODCALLTYPE Release(void) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount (UINT *pctinfo) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo (UINT iTInfo, LCID lcid, ITypeInfo *ppTInfo) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames (REFIID riid,
LPOLESTR *rgszNames,
UINT cNames,
LCID lcid,
DISPID *rgDispId) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Invoke (DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
EXCEPINFO *pExcepInfo,
UINT *puArgErr) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetName (int __RPC_FAR *pName) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetSelection (ITextSelection __RPC_FAR *__RPC_FAR *ppSel) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetStoryCount (long __RPC_FAR *pCount) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetStoryRanges (ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetSaved (long __RPC_FAR *pValue) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE SetSaved (long __RPC_FAR Value) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetDefaultTabStop (float *pValue) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE SetDefaultTabStop (float Value) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE New (void) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Open (VARIANT __RPC_FAR *pVar,
long Flags,
long CodePage) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Save (VARIANT __RPC_FAR *pVar,
long Flags,
long CodePage) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Freeze (long __RPC_FAR *pCount) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Unfreeze (long __RPC_FAR *pCount) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE BeginEditCollection (void) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE EndEditCollection (void) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Undo (long Count,
long __RPC_FAR *prop) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Redo (long Count,
long __RPC_FAR *prop) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Range (long cp1,
long cp2,
ITextRange __RPC_FAR *__RPC_FAR *ppRange) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE RangeFromPoint (long x,
long y,
ITextRange __RPC_FAR *__RPC_FAR *ppRange) {return E_NOTIMPL;}
};
and then:
CTextDocumentMutation* s_pTextDocMutation = new CTextDocumentMutation();
Which generates the error above.
What can be the problem here?
10x!
I'm trying to implement my own ITextDocument derived class.
In the first step, I only try to inherit my class from ITextDocument, and implement all its function with "return E_NOTIMPL".
For some reason, when I'm trying to create an instance of my derived class, I get an error "cannot instantiate abstract class" - Althought I implemented all the functions, including the IUnknown+IDispatch interdaces functions.
Here is my code:
#ifndef __cplusplus
#define __cplusplus
#endif
#ifdef CINTERFACE
#undef CINTERFACE
#endif
#include "tom.h"
struct CTextDocumentMutation : public ITextDocument
{
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void *ppvObject){return E_NOTIMPL;}
virtual ULONG STDMETHODCALLTYPE AddRef(void) {return E_NOTIMPL;}
virtual ULONG STDMETHODCALLTYPE Release(void) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount (UINT *pctinfo) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo (UINT iTInfo, LCID lcid, ITypeInfo *ppTInfo) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames (REFIID riid,
LPOLESTR *rgszNames,
UINT cNames,
LCID lcid,
DISPID *rgDispId) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Invoke (DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
EXCEPINFO *pExcepInfo,
UINT *puArgErr) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetName (int __RPC_FAR *pName) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetSelection (ITextSelection __RPC_FAR *__RPC_FAR *ppSel) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetStoryCount (long __RPC_FAR *pCount) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetStoryRanges (ITextStoryRanges __RPC_FAR *__RPC_FAR *ppStories) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetSaved (long __RPC_FAR *pValue) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE SetSaved (long __RPC_FAR Value) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE GetDefaultTabStop (float *pValue) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE SetDefaultTabStop (float Value) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE New (void) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Open (VARIANT __RPC_FAR *pVar,
long Flags,
long CodePage) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Save (VARIANT __RPC_FAR *pVar,
long Flags,
long CodePage) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Freeze (long __RPC_FAR *pCount) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Unfreeze (long __RPC_FAR *pCount) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE BeginEditCollection (void) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE EndEditCollection (void) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Undo (long Count,
long __RPC_FAR *prop) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Redo (long Count,
long __RPC_FAR *prop) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE Range (long cp1,
long cp2,
ITextRange __RPC_FAR *__RPC_FAR *ppRange) {return E_NOTIMPL;}
virtual HRESULT STDMETHODCALLTYPE RangeFromPoint (long x,
long y,
ITextRange __RPC_FAR *__RPC_FAR *ppRange) {return E_NOTIMPL;}
};
and then:
CTextDocumentMutation* s_pTextDocMutation = new CTextDocumentMutation();
Which generates the error above.
What can be the problem here?
10x!