Click here to Skip to main content
15,907,910 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: modeless dialog WM_CLOSE - opinion Pin
Rage15-Feb-06 3:59
professionalRage15-Feb-06 3:59 
mx483 wrote:
you don't want multiple instances of your modeless opened you will need to set the pointer to NULL


This is a curious way to avoid multiple instance. Is this a child dialog of your app or, the app itself ? Why don't you check if the dialog already exists before starting a new one ? If you destroy your dialog, a simple check on SafeWindow will tell you that your pointer is not used anymore. YOu could even fire up a message to your parent to reset the pointer if you really want to.

As for the examples, I think this is sufficient, no need to intercept another message.

void CDialogDerived::PostNcDestroy() 
{
    m_pParent->m_pModelessDialog = NULL;    
    delete this;
   CDialog::PostNcDestroy(); // I usually call the base class AFTER my processing
 
}


~RaGE();

[edit] I wrote teh same as Shog because I forgot to post my message right away... Nevermind, and great to see we are on the same wave length [/edit]

-- modified at 10:01 Wednesday 15th February, 2006
GeneralRe: modeless dialog WM_CLOSE - opinion Pin
23_44415-Feb-06 4:43
23_44415-Feb-06 4:43 
GeneralRe: modeless dialog WM_CLOSE - opinion Pin
23_44415-Feb-06 4:58
23_44415-Feb-06 4:58 
GeneralRe: modeless dialog WM_CLOSE - opinion Pin
Shog915-Feb-06 7:53
sitebuilderShog915-Feb-06 7:53 
GeneralRe: modeless dialog WM_CLOSE - opinion Pin
23_44415-Feb-06 8:00
23_44415-Feb-06 8:00 
AnswerRe: modeless dialog WM_CLOSE - opinion Pin
23_44416-Feb-06 5:17
23_44416-Feb-06 5:17 
GeneralRe: modeless dialog WM_CLOSE - opinion Pin
Shog916-Feb-06 10:32
sitebuilderShog916-Feb-06 10:32 
GeneralRe: modeless dialog WM_CLOSE - opinion Pin
23_44416-Feb-06 10:39
23_44416-Feb-06 10:39 
GeneralRe: modeless dialog WM_CLOSE - opinion Pin
Shog916-Feb-06 10:45
sitebuilderShog916-Feb-06 10:45 
GeneralRe: modeless dialog WM_CLOSE - opinion Pin
23_44416-Feb-06 11:15
23_44416-Feb-06 11:15 
GeneralRe: modeless dialog WM_CLOSE - opinion Pin
Shog916-Feb-06 11:32
sitebuilderShog916-Feb-06 11:32 
GeneralRe: modeless dialog WM_CLOSE - opinion Pin
23_44416-Feb-06 11:49
23_44416-Feb-06 11:49 
GeneralRe: modeless dialog WM_CLOSE - opinion Pin
Shog916-Feb-06 12:25
sitebuilderShog916-Feb-06 12:25 
GeneralRe: modeless dialog WM_CLOSE - opinion Pin
23_44417-Feb-06 8:56
23_44417-Feb-06 8:56 
QuestionShades of a color Pin
DirA15-Feb-06 2:25
DirA15-Feb-06 2:25 
AnswerRe: Shades of a color Pin
Maximilien15-Feb-06 2:53
Maximilien15-Feb-06 2:53 
AnswerRe: Shades of a color Pin
Stephen Hewitt15-Feb-06 19:00
Stephen Hewitt15-Feb-06 19:00 
AnswerRe: Shades of a color Pin
Stephen Hewitt15-Feb-06 23:51
Stephen Hewitt15-Feb-06 23:51 
GeneralRe: Shades of a color Pin
DirA25-Feb-06 2:59
DirA25-Feb-06 2:59 
GeneralRe: Shades of a color Pin
Stephen Hewitt25-Feb-06 4:09
Stephen Hewitt25-Feb-06 4:09 
QuestionMultiple instance like MS Word Pin
Anilkumar K V15-Feb-06 1:54
Anilkumar K V15-Feb-06 1:54 
AnswerRe: Multiple instance like MS Word Pin
David Crow15-Feb-06 3:47
David Crow15-Feb-06 3:47 
GeneralRe: Multiple instance like MS Word Pin
Anilkumar K V15-Feb-06 17:04
Anilkumar K V15-Feb-06 17:04 
GeneralRe: Multiple instance like MS Word Pin
ThatsAlok16-Feb-06 2:38
ThatsAlok16-Feb-06 2:38 
GeneralRe: Multiple instance like MS Word Pin
David Crow16-Feb-06 2:50
David Crow16-Feb-06 2:50 

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.