Click here to Skip to main content
15,921,660 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Error returning CStringArray as function result? Pin
Alvaro Mendez24-Feb-03 10:27
Alvaro Mendez24-Feb-03 10:27 
GeneralRe: Error returning CStringArray as function result? Pin
Christian Graus24-Feb-03 10:29
protectorChristian Graus24-Feb-03 10:29 
GeneralRe: Error returning CStringArray as function result? Pin
Alvaro Mendez24-Feb-03 11:03
Alvaro Mendez24-Feb-03 11:03 
GeneralRe: Error returning CStringArray as function result? Pin
Christian Graus24-Feb-03 11:31
protectorChristian Graus24-Feb-03 11:31 
Generaldeleting a CDialog... Pin
ns24-Feb-03 9:03
ns24-Feb-03 9:03 
GeneralRe: deleting a CDialog... Pin
Alvaro Mendez24-Feb-03 9:15
Alvaro Mendez24-Feb-03 9:15 
GeneralRe: deleting a CDialog... Pin
ns24-Feb-03 9:22
ns24-Feb-03 9:22 
GeneralRe: deleting a CDialog... Pin
Alvaro Mendez24-Feb-03 10:22
Alvaro Mendez24-Feb-03 10:22 
Here's what I would do:

1. Use this code to create the dialog box:

static CMyDlg s_dlg;
 
if (!::IsWindow(s_dlg.m_hWnd))
   s_dlg.Create(CMyDlg::IDD, this);
s_dlg.ShowWindow(SW_SHOWNORMAL);


2. Inside your OnClose, call DestroyWindow();

This ensures your dialog is created only once and that it's properly destroyed.

ns wrote:
you said" it will blow up..." why ?

Sorry, typo. I modified my post. I meant that it will blow up if you call delete this and the dialog is not created with new. It's because it will try to free memory from the heap which wasn't allocated on the heap to begin with.

Regards,
Alvaro



The world is a dangerous place, not because of those who do evil, but because of those who look on and do nothing. -- Albert Einstein
Generaloay, got it! Quick ques.. Pin
ns25-Feb-03 2:14
ns25-Feb-03 2:14 
GeneralRe: oay, got it! Quick ques.. Pin
Alvaro Mendez25-Feb-03 4:25
Alvaro Mendez25-Feb-03 4:25 
GeneralRe: deleting a CDialog... Pin
Nish Nishant24-Feb-03 9:17
sitebuilderNish Nishant24-Feb-03 9:17 
Generalthanks!! Also need to know... Pin
ns24-Feb-03 9:28
ns24-Feb-03 9:28 
GeneralRe: deleting a CDialog... Pin
valikac24-Feb-03 9:17
valikac24-Feb-03 9:17 
GeneralRe: deleting a CDialog... Pin
User 665824-Feb-03 9:18
User 665824-Feb-03 9:18 
GeneralRe: deleting a CDialog... Pin
AlexO24-Feb-03 9:21
AlexO24-Feb-03 9:21 
GeneralDevice context with diffrent color of pen object Pin
mkashifkkj24-Feb-03 8:42
mkashifkkj24-Feb-03 8:42 
GeneralRe: Device context with diffrent color of pen object Pin
Chris Losinger24-Feb-03 9:46
professionalChris Losinger24-Feb-03 9:46 
QuestionRectangels and directdraw? Pin
anden24-Feb-03 8:21
anden24-Feb-03 8:21 
GeneralEnter to Select button Pin
sstiller24-Feb-03 7:40
sstiller24-Feb-03 7:40 
GeneralRe: Enter to Select button Pin
Alvaro Mendez24-Feb-03 9:05
Alvaro Mendez24-Feb-03 9:05 
GeneralRe: Enter to Select button Pin
valikac24-Feb-03 9:23
valikac24-Feb-03 9:23 
GeneralRe: Enter to Select button Pin
sstiller26-Feb-03 19:09
sstiller26-Feb-03 19:09 
GeneralDelete a security group in VC 7.0 Pin
Member 13661824-Feb-03 5:49
Member 13661824-Feb-03 5:49 
GeneralRe: Delete a security group in VC 7.0 Pin
Dana Epp24-Feb-03 7:59
Dana Epp24-Feb-03 7:59 
Generallaunching dos programs(gui) Pin
eggman2124-Feb-03 5:39
eggman2124-Feb-03 5:39 

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.