Click here to Skip to main content
16,006,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Need help for Server-Client Application. Pin
Le@rner8-Feb-10 1:08
Le@rner8-Feb-10 1:08 
QuestionOracle select * from table name Pin
MsmVc4-Feb-10 18:01
MsmVc4-Feb-10 18:01 
QuestionDialog is getting close automatically Pin
chevu4-Feb-10 16:46
chevu4-Feb-10 16:46 
AnswerRe: Dialog is getting close automatically Pin
Avi Berger4-Feb-10 17:28
Avi Berger4-Feb-10 17:28 
GeneralRe: Dialog is getting close automatically Pin
chevu4-Feb-10 17:48
chevu4-Feb-10 17:48 
GeneralRe: Dialog is getting close automatically Pin
Avi Berger4-Feb-10 18:30
Avi Berger4-Feb-10 18:30 
GeneralRe: Dialog is getting close automatically Pin
chevu4-Feb-10 18:39
chevu4-Feb-10 18:39 
GeneralRe: Dialog is getting close automatically Pin
Avi Berger4-Feb-10 20:50
Avi Berger4-Feb-10 20:50 
I don't think that the code you posted is the problem. It also doesn't seem that useful to me.

Now chevu wrote:
No I am not stoping dialog from being close


Combined with other things that you have said, this suggests to me that we may actually be getting somewhere.

First, I'll explicitly state my understanding that we are discussing modeless dialog boxes with associated classes derived from CDialog.

Now let me try to quickly summarize lots of stuff. Some of this may seem to simple to mention. I'm doing it anyway because I suspect that you are missing part of this, but I don't know what part.

In working with modeless dialog boxes in MFC there are 2 things around that one has to worry about. One is a C++ object instantiated from a class derived from CDialog. This is normally dynamically allocated so that its lifetime can be properly managed. The other is the windows object (not a C++ object) that Windows maintains and deals with that a windows handle is connected to. They are associated, but they are somewhat independent things.

A class for a modeless dialog overrides OnOK and OnCancel and does NOT call the default versions. The default ones in CDialog call EndDialog() which is intended for use with modal, not modeless dialogs. (I'm not sure of all the implications of calling it for a modeless dialog, but I suspect this may be a part of your situation.) These overrides might call DestroyWindow() to terminate the dialog and kill the windows object. When it is desired that the dynamically allocated C++ object self-destructs when the dialog is closed, PostNcDestroy() is also overriden.

Typically, one constructs the C++ object and calls Create() which creates and associates the windows object. Later, the user exits the dialog in some way. The programmer has provided code for this that includes a call to DestroyWindow(). Then some programmer provided mechanism deletes the C++ object.

Now you want to do things differently. Once things are created, you want to keep things around (though not necessarily displayed) until the program exits. So when the user "closes" the dialog instead of destroying the window object (via DestroyWindow) and deleting the C++ object, you are writing code to hide the window and keep track that you have done this. Then when you want to display the dialog again you would just show the window.

It now sounds like this isn't what you are actually doing. Perhaps you are letting EndDialog() be called. I don't know just what state that would leave the window object in.

Hopefully this gives you some direction. Now I have to get to bed before I finish falling asleep.
Questionclass instance address Pin
transoft4-Feb-10 10:46
transoft4-Feb-10 10:46 
AnswerRe: class instance address Pin
Abhi Lahare4-Feb-10 10:54
Abhi Lahare4-Feb-10 10:54 
GeneralRe: class instance address Pin
transoft4-Feb-10 11:05
transoft4-Feb-10 11:05 
GeneralRe: class instance address Pin
Graham Breach4-Feb-10 11:24
Graham Breach4-Feb-10 11:24 
GeneralRe: class instance address Pin
transoft4-Feb-10 11:30
transoft4-Feb-10 11:30 
GeneralRe: class instance address Pin
Avi Berger4-Feb-10 11:42
Avi Berger4-Feb-10 11:42 
GeneralRe: class instance address Pin
transoft4-Feb-10 12:09
transoft4-Feb-10 12:09 
AnswerRe: class instance address Pin
Avi Berger4-Feb-10 11:31
Avi Berger4-Feb-10 11:31 
QuestionDos subclassing Pin
aurelcly4-Feb-10 8:14
aurelcly4-Feb-10 8:14 
QuestionRe: Dos subclassing Pin
David Crow4-Feb-10 8:27
David Crow4-Feb-10 8:27 
AnswerRe: Dos subclassing Pin
Maximilien4-Feb-10 8:38
Maximilien4-Feb-10 8:38 
AnswerRe: Dos subclassing Pin
Richard MacCutchan4-Feb-10 8:48
mveRichard MacCutchan4-Feb-10 8:48 
AnswerRe: Dos subclassing Pin
Code-o-mat4-Feb-10 8:50
Code-o-mat4-Feb-10 8:50 
AnswerRe: Dos subclassing Pin
Avi Berger4-Feb-10 9:13
Avi Berger4-Feb-10 9:13 
GeneralRe: Dos subclassing Pin
loyal ginger4-Feb-10 11:16
loyal ginger4-Feb-10 11:16 
GeneralRe: Dos subclassing Pin
Avi Berger4-Feb-10 12:42
Avi Berger4-Feb-10 12:42 
QuestionDeclaring Variables Pin
gregarion4-Feb-10 7:48
gregarion4-Feb-10 7:48 

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.