Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

'ATL::CComObject<Base>' : cannot instantiate abstract class

2,065 views
Skip to first unread message

dctr5e

unread,
Sep 26, 2009, 2:03:01 PM9/26/09
to
I got the following error with identical declared/defined members in .cpp and
.h:

C:\Program Files\Microsoft Visual Studio
9.0\VC\atlmfc\include\atlcom.h(1801) : error C2259: 'ATL::CComObject<Base>' :
cannot instantiate abstract class
with
[
Base=IExtendPropertySheet2
]
due to following members:
'HRESULT
IExtendPropertySheet::CreatePropertyPages(LPPROPERTYSHEETCALLBACK,LONG_PTR,LPDATAOBJECT)' : is abstract
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\Mmc.h(3096) :
see declaration of 'IExtendPropertySheet::CreatePropertyPages'
'HRESULT IExtendPropertySheet::QueryPagesFor(LPDATAOBJECT)' : is
abstract
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\Mmc.h(3101) :
see declaration of 'IExtendPropertySheet::QueryPagesFor'
'HRESULT IExtendPropertySheet2::GetWatermarks(LPDATAOBJECT,HBITMAP
*,HBITMAP *,HPALETTE *,BOOL *)' : is abstract
C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\Mmc.h(3977) :
see declaration of 'IExtendPropertySheet2::GetWatermarks'
C:\Program Files\Microsoft Visual Studio
9.0\VC\atlmfc\include\atlcom.h(1790) : while compiling class template member
function 'HRESULT ATL::CComCreator<T1>::CreateInstance(void *,const IID
&,LPVOID *)'
with
[
T1=ATL::CComObject<IExtendPropertySheet2>
]


SerSnapExt.h:

STDMETHODIMP CreatePropertyPages(
LPPROPERTYSHEETCALLBACK ,
LONG_PTR ,
LPDATAOBJECT
);

STDMETHODIMP QueryPagesFor(LPDATAOBJECT);
STDMETHODIMP GetWatermarks(
LPDATAOBJECT,
HBITMAP,
HBITMAP,
HPALETTE,
BOOL
);

ServSnapExt.cpp:

STDMETHODIMP GetWatermarks( LPDATAOBJECT lpIDataObject, HBITMAP
*lphWatermark, HBITMAP *lphHeader, HPALETTE *lphPalette, BOOL *bStretch)
{
...

STDMETHODIMP QueryPagesFor( DATA_OBJECT_TYPES lpDataObject)
{
...

STDMETHODIMP CreatePropertyPages(LPPROPERTYSHEETCALLBACK lpProvider,long
handle, IUnknown* pUnk,DATA_OBJECT_TYPES lpIDataObject)
{
...

any suggestion?

dctr5e

unread,
Sep 26, 2009, 2:15:01 PM9/26/09
to
i posted the wrong arguments for the functions, sorry about this.

But hoever i change them between old/new ones i get the "abstract" error.

The declaration posted under SerSnapExt.h: is the same as in the included
Mmc.h.

Tom Walker

unread,
Sep 26, 2009, 6:43:44 PM9/26/09
to

"dctr5e" <dct...@discussions.microsoft.com> wrote in message
news:E5B5E1CA-6E5A-4338...@microsoft.com...

>
> The declaration posted under SerSnapExt.h: is the same as in the included
> Mmc.h.
>
>> STDMETHODIMP GetWatermarks(
>> LPDATAOBJECT,
>> HBITMAP,
>> HBITMAP,
>> HPALETTE,
>> BOOL
>> );

According to Mmc.h this should be:

STDMETHODIMP GetWatermarks(
LPDATAOBJECT,
HBITMAP *,
HBITMAP *,
HPALETTE *,
BOOL *
);

Igor Tandetnik

unread,
Sep 26, 2009, 7:33:33 PM9/26/09
to
dctr5e wrote:
> I got the following error with identical declared/defined members in
> .cpp and .h:
>
> C:\Program Files\Microsoft Visual Studio
> 9.0\VC\atlmfc\include\atlcom.h(1801) : error C2259:
> 'ATL::CComObject<Base>' :
> cannot instantiate abstract class
> with
> [
> Base=IExtendPropertySheet2
> ]

How did you manage to instantiate CComObject<IExtendPropertySheet2> ?
The template parameter of CComObject is supposed to be your class
(usually implementing one or more interfaces), not the interface itself.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


dctr5e

unread,
Sep 27, 2009, 12:29:02 PM9/27/09
to
> How did you manage to instantiate CComObject<IExtendPropertySheet2> ?
> The template parameter of CComObject is supposed to be your class
> (usually implementing one or more interfaces), not the interface itself.
> --
> With best wishes,
> Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925
>
>
>
That was exactly the mistake. I tried to instantiate IExtendPropertySheet2
correctly with IExtendPropertySheetImpl prior what didn't work too.

After including atlsnap.h everything works fine.

Thanks a lot for your help.

0 new messages