hi
i have an application made of several dialogs
each has its own exit button
my question:
whan i press the exit button ... iwant to exit the whole application (not exit the present dialog and return to the Previous one )
how can i do that .....please help me out with this
thank u all

Recommended Answers

All 6 Replies

hi
i have an application made of several dialogs
each has its own exit button
my question:
whan i press the exit button ... iwant to exit the whole application (not exit the present dialog and return to the Previous one )
how can i do that .....please help me out with this
thank u all

Are you on Windows or ..? Are you using some GUI library?

In the event handler for the exit button send a WM_QUIT event message to the program's main thread. More information is discussed here.

ah i just coded a win32 application and i used the following:

Quit program ( the [ x ] ) in the corner

case WM_DESTROY:
{
	PostQuitMessage(0);
	break;
}

you could also do

case <button name>:
{
	PostQuitMessage(0);
	break;
}

PostQuitMessage();

http://msdn.microsoft.com/en-us/library/ms644945(VS.85).aspx

I hope i did this correctly because last time i tryed to give help i got a warning :(

my application is MFC dialog based application

i used
PostMessage(WM_QUIT);
and got
Error: CWinThread::PumpMessage called when not permitted.
could someone explain pleeease

where did you put that PostMessage(). And why didn't you just use PostQuitMessage() as previously suggested?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.