I presume you're trying all that because the dialog instance is modeless?
In that case you shouldn't be calling the base class OnOK() from your override, but only DestroyWindow().
If you have to delete this
then an override of PostNcDestroy()
is the appropriate place.