954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

exit button

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

lahom
Light Poster
42 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 
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?

mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395
 

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 .

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

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 :(

FTProtocol
Junior Poster
102 posts since May 2008
Reputation Points: -14
Solved Threads: 1
 

my application is MFC dialog based application

lahom
Light Poster
42 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

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

lahom
Light Poster
42 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

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

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You