| 
 | 
Thank you Rufeng, I changed the program a little bit. 
 
Now I want to send a message to the main form when the child window is closed, delete the subform pointer and assign NULL 
 
Here is the added message map 
    BEGIN_MESSAGE_MAP 
        MESSAGE_HANDLER (WM_FORM_CLOSE, TMessage, CMMessage) 
    END_MESSAGE_MAP (TForm1) 
 
Custom message, the program runs together hereEND_MESSAGE_MAP (TForm1) Here is the stack overflow, why is this? |   
 
 
 
 |