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

Correctly implementing a property page with IPropertyPage2 support

33 views
Skip to first unread message

Timo Kunze

unread,
Mar 18, 2010, 7:11:19 PM3/18/10
to
Hi,

I've implemented the property page of my ActiveX control like that:

class ATL_NO_VTABLE StringProperties :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<StringProperties, &CLSID_StringProperties>,
public IPropertyPageImpl<StringProperties>,
public CDialogImpl<StringProperties>
{
public:
DECLARE_REGISTRY_RESOURCEID(IDR_STRINGPROPERTIES)

BEGIN_COM_MAP(StringProperties)
COM_INTERFACE_ENTRY(IPropertyPage)
END_COM_MAP()

// ...
};

This works fine in Visual Basic 6.

Now I want to add IPropertyPage2 support. So I changed the class to
derive from IPropertyPage2Impl:

class ATL_NO_VTABLE StringProperties :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<StringProperties, &CLSID_StringProperties>,
public IPropertyPage2Impl<StringProperties>,
public CDialogImpl<StringProperties>
{
public:
DECLARE_REGISTRY_RESOURCEID(IDR_STRINGPROPERTIES)

BEGIN_COM_MAP(StringProperties)
COM_INTERFACE_ENTRY(IPropertyPage)
COM_INTERFACE_ENTRY2(IPropertyPage2, IPropertyPage)
END_COM_MAP()

// ...
};

This compiles, but if I click the "..." next to the property in VB6's
property grid, I get an access violation in ~CComObject. I think the COM
object's ref-counting is broken, but I don't know what's missing.
I don't get this access violation if I open the property pages through
the (Property Pages) entry in the property grid.

What am I doing wrong? I use Visual C++ 2008 SP1 with ATL 9.0 and WTL 8.1.

Regards
Timo
--
www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
"Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der
Überzeugung, dass die demokratischen Kräfte überwiegen und sich – auf
demokratischem Wege – durchsetzen."

Vi2

unread,
Mar 19, 2010, 7:00:14 AM3/19/10
to
On 19 мар, 03:11, Timo Kunze <TKunze71...@gmx.de> wrote:

> This compiles, but if I click the "..." next to the property in VB6's
> property grid, I get an access violation in ~CComObject. I think the COM
> object's ref-counting is broken, but I don't know what's missing.
> I don't get this access violation if I open the property pages through
> the (Property Pages) entry in the property grid.
>

> What am I doing wrong? I use VC2008 SP1 with ATL 9.0 and WTL 8.1.


I have only found that VC2008's "virtual ~IPropertyPageImpl()" doesn't
correspond to VC6's "~IPropertyPageImpl()". But I'm not sure that is a
problem. It's should be tested.

Timo Kunze

unread,
Mar 20, 2010, 7:35:55 AM3/20/10
to
Am 19.03.2010 12:00, schrieb Vi2:
> I have only found that VC2008's "virtual ~IPropertyPageImpl()" doesn't
> correspond to VC6's "~IPropertyPageImpl()". But I'm not sure that is a
> problem. It's should be tested.

I've removed the "virtual" keyword, but it doesn't make a difference.
The crash occurs after leaving IPropertyPageImpl::Show. The call comes
directly from the VB6 IDE.

andreas....@googlemail.com

unread,
Nov 4, 2013, 4:26:39 AM11/4/13
to
Hello Timo,

have you any solutions for this problem ? I updated a app from VC6 to VS2010 and run into the same problem ....

Best regards Andreas
0 new messages