Click here to Skip to main content
16,011,988 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to compile win32 program in bcb 5.0 Pin
Carlos Antollini8-Feb-02 2:35
Carlos Antollini8-Feb-02 2:35 
GeneralRe: how to compile win32 program in bcb 5.0 Pin
Johndotcom8-Feb-02 18:28
Johndotcom8-Feb-02 18:28 
GeneralCan't find the clrscr() program Pin
Fredrik N7-Feb-02 2:47
Fredrik N7-Feb-02 2:47 
GeneralRe: Can't find the clrscr() program Pin
Carlos Antollini7-Feb-02 3:06
Carlos Antollini7-Feb-02 3:06 
GeneralRe: Can't find the clrscr() program Pin
Atul Dharne7-Feb-02 3:26
Atul Dharne7-Feb-02 3:26 
GeneralA simple query on VC++ Pin
7-Feb-02 2:12
suss7-Feb-02 2:12 
GeneralRe: A simple query on VC++ Pin
Jon Hulatt7-Feb-02 2:41
Jon Hulatt7-Feb-02 2:41 
GeneralRe: A simple query on VC++ Pin
7-Feb-02 3:02
suss7-Feb-02 3:02 
Here goes:-
I have an application where one dialog is active at a time.
I want to destroy the active dialog on the click of a button present on that dialog and bring up another dialog.

The surprising thing here is that in the function OnClick( ) the destructor of the dialog is called first as I am deleting the dialog pointer and then the remaining part of the code is executed.
What is nagging me is how this is possible that even after deleting the dialog a member function of that dialog is still executing ??

I am enclosing the code to make my point clearer:

void CDialog1::OnButton1()
{
theApp.myDlg->DestroyWindow();
delete(theApp.myDlg); //Destructor is called at this point
theApp.myDlg = NULL;
AfxMessageBox("This function is continued after the destructor");
}

Here the message box should not be displayed, but surprise surprise !!
The message box is displayed and the application works fine.

Any answers ??
Confused | :confused:
GeneralRe: A simple query on VC++ Pin
Jon Hulatt7-Feb-02 3:27
Jon Hulatt7-Feb-02 3:27 
GeneralRe: A simple query on VC++ Pin
7-Feb-02 4:21
suss7-Feb-02 4:21 
GeneralRe: A simple query on VC++ Pin
Jon Hulatt7-Feb-02 4:34
Jon Hulatt7-Feb-02 4:34 
GeneralRe: A simple query on VC++ Pin
pba_7-Feb-02 11:34
pba_7-Feb-02 11:34 
GeneralRe: A simple query on VC++ Pin
7-Feb-02 14:29
suss7-Feb-02 14:29 
GeneralRe: A simple query on VC++ Pin
pba_8-Feb-02 4:13
pba_8-Feb-02 4:13 
Generalarrays Pin
7-Feb-02 1:50
suss7-Feb-02 1:50 
GeneralRe: arrays Pin
Tim Smith7-Feb-02 2:31
Tim Smith7-Feb-02 2:31 
GeneralRe: arrays Pin
Jon Hulatt7-Feb-02 2:45
Jon Hulatt7-Feb-02 2:45 
GeneralRe: arrays Pin
7-Feb-02 4:27
suss7-Feb-02 4:27 
GeneralRe: arrays Pin
Jon Hulatt7-Feb-02 4:37
Jon Hulatt7-Feb-02 4:37 
GeneralRe: arrays Pin
Carlos Antollini7-Feb-02 3:08
Carlos Antollini7-Feb-02 3:08 
GeneralRe: arrays Pin
Christian Graus7-Feb-02 9:47
protectorChristian Graus7-Feb-02 9:47 
General.obj to .cpp file conversion.. Pin
Neha7-Feb-02 0:42
Neha7-Feb-02 0:42 
GeneralRe: .obj to .cpp file conversion.. Pin
Nish Nishant7-Feb-02 0:45
sitebuilderNish Nishant7-Feb-02 0:45 
GeneralRe: .obj to .cpp file conversion.. Pin
Neha7-Feb-02 0:51
Neha7-Feb-02 0:51 
GeneralRe: .obj to .cpp file conversion.. Pin
Atul Dharne7-Feb-02 3:37
Atul Dharne7-Feb-02 3:37 

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.