Click here to Skip to main content
14,930,401 members
Home / Discussions / C / C++ / MFC

C / C++ / MFC

GeneralRe: hi all Pin
ashish dogra28-Jun-06 20:00
Memberashish dogra28-Jun-06 20:00 
GeneralRe: hi all Pin
Hamid_RT28-Jun-06 20:05
MemberHamid_RT28-Jun-06 20:05 
GeneralRe: hi all Pin
ashish dogra28-Jun-06 20:45
Memberashish dogra28-Jun-06 20:45 
GeneralRe: hi all Pin
Hamid_RT28-Jun-06 20:46
MemberHamid_RT28-Jun-06 20:46 
GeneralRe: hi all Pin
ashish dogra28-Jun-06 21:05
Memberashish dogra28-Jun-06 21:05 
GeneralRe: hi all Pin
Hamid_RT28-Jun-06 21:32
MemberHamid_RT28-Jun-06 21:32 
GeneralRe: hi all Pin
ashish dogra28-Jun-06 21:45
Memberashish dogra28-Jun-06 21:45 
AnswerRe: hi all [modified] Pin
ovidiucucu28-Jun-06 20:31
Memberovidiucucu28-Jun-06 20:31 
After exiting DoModal, the attached window of CDialog object is destroyed and detached, so there is no problem to call DoModal again.
For a modeless dialog (made with CDialog::Create), unless the CDialog object goes out-of scope or DestroyWindow was called, the window is not destroyed, not even the user pushes OK/Cancel/close button.
So you have to test if the dialog was created before call CDialog::Create.
If yes, then simply show it:
void CFoo::ShowModelessDialog(CDialog& dlg, UINT nResID)
   if(!::IsWindow(dlg.m_hWnd)) // thest attached window handle
       // create only if not yet created
      dlg.Create(nResID, this);
// ...
// ... somewhere ...
   ShowDialog(m_dlg, IDD_DIALOG1);
// ... and no problem to show again
   ShowDialog(m_dlg, IDD_DIALOG1);

NOTE: You can test m_hWnd against NULL instead of calling ::IsWindow, as well.

Ovidiu Cucu
Microsoft MVP - Visual C++
GeneralRe: hi all Pin
Nawal K Gupta28-Jun-06 21:03
MemberNawal K Gupta28-Jun-06 21:03 
GeneralRe: hi all Pin
ovidiucucu28-Jun-06 22:21
Memberovidiucucu28-Jun-06 22:21 
Questionregarding CFile Pin
happy_ram28-Jun-06 19:29
Memberhappy_ram28-Jun-06 19:29 
AnswerRe: regarding CFile Pin
Naveen28-Jun-06 19:33
MemberNaveen28-Jun-06 19:33 
AnswerRe: regarding CFile Pin
David Crow29-Jun-06 3:19
MemberDavid Crow29-Jun-06 3:19 
QuestionProblem with wizard type application Pin
rajeevktripathi28-Jun-06 19:10
Memberrajeevktripathi28-Jun-06 19:10 
AnswerRe: Problem with wizard type application Pin
Blake Miller29-Jun-06 4:56
MemberBlake Miller29-Jun-06 4:56 
QuestionPrinting [modified] Pin
RockyJames28-Jun-06 18:38
MemberRockyJames28-Jun-06 18:38 
AnswerRe: Printing Pin
Hamid_RT28-Jun-06 19:29
MemberHamid_RT28-Jun-06 19:29 
GeneralRe: Printing [modified] Pin
RockyJames28-Jun-06 22:33
MemberRockyJames28-Jun-06 22:33 
GeneralRe: Printing Pin
Hamid_RT28-Jun-06 23:13
MemberHamid_RT28-Jun-06 23:13 
Questiondialog box Pin
amit.code28-Jun-06 18:36
Memberamit.code28-Jun-06 18:36 
AnswerRe: dialog box Pin
ashish dogra28-Jun-06 18:53
Memberashish dogra28-Jun-06 18:53 
AnswerRe: dialog box Pin
songlei28-Jun-06 18:54
Membersonglei28-Jun-06 18:54 
AnswerRe: dialog box Pin
Hamid_RT28-Jun-06 18:57
MemberHamid_RT28-Jun-06 18:57 
Questionhow to change email address in outlook2003(VC6) [modified] Pin
cpusoft28-Jun-06 18:29
Membercpusoft28-Jun-06 18:29 
AnswerRe: how to change email address in outlook2003(VC6) Pin
Viorel.28-Jun-06 20:36
MemberViorel.28-Jun-06 20:36 

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.