The destructor or my Active Directory's extended property sheet(COM) is not being invokedd at time of exit.

Posted on 2006-04-19
Medium Priority
Last Modified: 2013-12-03
Hi Expert,
I'm wroking on a COM in-proc server using C++ in VS 2005 using only the win libraries.  This is to create 3 extended property pages in Active Directory.  I have a base class, CpropertyPage, which is from MS SDK for mmc's ppgext.cpp.  My property pages are display as one of the tab in AD's Computer, Users and Groups property window.  

The question I have is, how can I get my property sheet's destructor be called or invoked (actually I think mmc does this).  I know my base class CpropertyPage's destructor is being called when I click OK button to exit the property window.  I have to do some memory clean up in my own destructor and thus need each of my property sheet's destructor to be called.  

Thank you.
Question by:lapucca
  • 2
LVL 86

Accepted Solution

jkr earned 1000 total points
ID: 16498258
Actually, the destructor will be called by your 'Release()' method when the reference counter drops to zero, e.g.

ULONG MyComObj::Release() {

    if (!--m_ulRefCnt) {

        delete this; // destroy object, invoke MyComObj::~MyComObj()

    return m_ulRefCnt;

Author Comment

ID: 16504098
Thank you expert jkr,

The standard COM interface are implemented in the base class CPropertyShee and it's Release method is invoked but it only calls it's destructor and its child class, my AD extended property sheets' destructor was never invoked.  
I tried calling my own destructor today at the DialogProc method but it casued an Assertion Error and crashed the appl.  

Should I (and can I ) add a Release mehtod in the child property sheets module to do this?  


Author Comment

ID: 16522008
To sovle this problem I had to virtual the destructor of the base class.  The child desctor of my property sheet is then invoked.  thanks.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question