The MFC implementation of CPropertySheet relies on the 'this'-pointer to be available, even when the property sheet constructions fails!When a property sheet cannot be constructed it is common practice to return -1 when handling the message WM_CREATE/OnCreate(). And it is also common practice to perform a 'delete this'-construction in PostNcDestroy to clean up the CWnd-derivative window object for a modeless window.When this construction is used for a modeless CPropertySheet, the MFC will crash in the function:BOOL CPropertySheet::Create(CWnd* pParentWnd, DWORD dwStyle, DWORD dwExStyle)at the position:this->DestroyWindow();OK, meanwhile I'm using PostMessage(WM_CLOSE) in order to avoid opening the sheet. However, the property sheet still becomes visible for a second, as can be seen when a breakpoint is set in the function CPropertySheet::Create(CWnd* pParentWnd, DWORD dwStyle, DWORD dwExStyleat the position:// cleanup on failure, otherwise return TRUEif (!AfxUnhookWindowCreate()) PostNcDestroy(); // cleanup if Create fails
Visual Studio/Team Foundation Server/.NET Framework Tooling version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results