Table of Contents Previous topic Next topic
Using the Visual C++ Custom AppWizard->Tutorial - Creating an Extension with the AppWizard->Finalising Support for your Dialog Box->Closing and Reopening your Dialog Box->Handling the Close Event
When the dialog box is closed, the pointer to its class instance that CExtentionState uses must be set to NULL. A convenient way to do this is to intercept the WM_CLOSE message that the dialog box class receives.
Open file MessageDlg.cpp. Right mouse click on the document and select ClassWizard from the context menu. With CMessageDlg selected as the Object ID, scroll down the messages list and select WM_CLOSE. Click on Add Function to create function OnClose(). Click on Edit Code to edit this function. Add the bold lines. Also comment out the line CDialog::OnClose() to prevent the base class function from being called.
extern CMessageDlg* g_pMessageDlg;
g_pMessageDlg = NULL;