Click here to Skip to main content
15,925,081 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: VC++6 : MFC and dialog based app: how can I ensure that a dialog destructor will be called? Pin
Joan M29-Dec-06 7:29
professionalJoan M29-Dec-06 7:29 
GeneralRe: VC++6 : MFC and dialog based app: how can I ensure that a dialog destructor will be called? Pin
CPallini29-Dec-06 8:18
mveCPallini29-Dec-06 8:18 
GeneralRe: VC++6 : MFC and dialog based app: how can I ensure that a dialog destructor will be called? Pin
Joan M29-Dec-06 9:20
professionalJoan M29-Dec-06 9:20 
GeneralRe: VC++6 : MFC and dialog based app: how can I ensure that a dialog destructor will be called? Pin
David Crow29-Dec-06 7:55
David Crow29-Dec-06 7:55 
GeneralRe: VC++6 : MFC and dialog based app: how can I ensure that a dialog destructor will be called? Pin
Joan M29-Dec-06 9:22
professionalJoan M29-Dec-06 9:22 
QuestionRe: VC++6 : MFC and dialog based app: how can I ensure that a dialog destructor will be called? Pin
David Crow29-Dec-06 7:50
David Crow29-Dec-06 7:50 
AnswerRe: VC++6 : MFC and dialog based app: how can I ensure that a dialog destructor will be called? Pin
Joan M29-Dec-06 7:56
professionalJoan M29-Dec-06 7:56 
AnswerRe: VC++6 : MFC and dialog based app: how can I ensure that a dialog destructor will be called? Pin
Gary R. Wheeler30-Dec-06 4:07
Gary R. Wheeler30-Dec-06 4:07 
I'm not sure if this helps, but a common approach with modeless dialogs is for them to delete themselves in their PostNcDestroy() handler, something like this:
// create and show the modeless dialog:
CMyModelessDlg *dlg = new CMyModelessDlg;
dlg->Create(...);
dlg->ShowWindow(SW_SHOW);
//...

CMyModelessDlg::PostNcDestroy()
{
  CDialog::PostNcDestroy();
  delete this;
}
The WM_NCDESTROY message is guaranteed to be the last Windows message sent to the dialog. The PostNcDestroy handler, which is called after the window itself has been destroyed, is the last time a member of the MFC object will be called.

Using this technique, you don't need to keep track of when the user closes the modeless dialog. If you read my sig, you'll notice I've been here before Big Grin | :-D .


Software Zen: delete this;

GeneralRe: VC++6 : MFC and dialog based app: how can I ensure that a dialog destructor will be called? Pin
Joan M30-Dec-06 4:39
professionalJoan M30-Dec-06 4:39 
GeneralRe: VC++6 : MFC and dialog based app: how can I ensure that a dialog destructor will be called? Pin
Joan M30-Dec-06 4:41
professionalJoan M30-Dec-06 4:41 
GeneralRe: VC++6 : MFC and dialog based app: how can I ensure that a dialog destructor will be called? Pin
Gary R. Wheeler30-Dec-06 8:29
Gary R. Wheeler30-Dec-06 8:29 
GeneralRe: VC++6 : MFC and dialog based app: how can I ensure that a dialog destructor will be called? Pin
Joan M30-Dec-06 8:36
professionalJoan M30-Dec-06 8:36 
Questionscan string for characters \ / ? * : " Pin
rolfhorror29-Dec-06 6:05
rolfhorror29-Dec-06 6:05 
AnswerRe: scan string for characters \ / ? * : " Pin
Joan M29-Dec-06 6:49
professionalJoan M29-Dec-06 6:49 
GeneralRe: scan string for characters \ / ? * : " Pin
rolfhorror29-Dec-06 7:24
rolfhorror29-Dec-06 7:24 
AnswerRe: scan string for characters \ / ? * : " Pin
CPallini29-Dec-06 6:52
mveCPallini29-Dec-06 6:52 
AnswerRe: scan string for characters \ / ? * : " Pin
Michael Dunn29-Dec-06 7:00
sitebuilderMichael Dunn29-Dec-06 7:00 
QuestionRe: scan string for characters \ / ? * : " Pin
David Crow29-Dec-06 7:48
David Crow29-Dec-06 7:48 
AnswerRe: scan string for characters \ / ? * : " Pin
James R. Twine29-Dec-06 9:27
James R. Twine29-Dec-06 9:27 
Questionunsigned char (*) warning msg Pin
ikbahrian29-Dec-06 2:42
ikbahrian29-Dec-06 2:42 
AnswerRe: unsigned char (*) warning msg Pin
CPallini29-Dec-06 3:13
mveCPallini29-Dec-06 3:13 
GeneralRe: unsigned char (*) warning msg Pin
ikbahrian29-Dec-06 3:29
ikbahrian29-Dec-06 3:29 
AnswerRe: unsigned char (*) warning msg Pin
David Crow29-Dec-06 3:22
David Crow29-Dec-06 3:22 
GeneralRe: unsigned char (*) warning msg Pin
ikbahrian1-Jan-07 4:25
ikbahrian1-Jan-07 4:25 
Questionchar set int value.. Pin
davvid29-Dec-06 2:41
davvid29-Dec-06 2:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.