944,006 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 3656
  • C++ RSS
Jun 29th, 2008
0

exit button

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
lahom is offline Offline
42 posts
since Apr 2008
Jun 29th, 2008
0

Re: exit button

Click to Expand / Collapse  Quote originally posted by lahom ...
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?
Reputation Points: 1105
Solved Threads: 389
Posting Virtuoso
mitrmkar is offline Offline
1,714 posts
since Nov 2007
Jun 29th, 2008
0

Re: exit button

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005
Jun 29th, 2008
0

Re: exit button

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

Quit program ( the [ x ] ) in the corner
C++ Syntax (Toggle Plain Text)
  1. case WM_DESTROY:
  2. {
  3. PostQuitMessage(0);
  4. break;
  5. }

you could also do

C++ Syntax (Toggle Plain Text)
  1. case <button name>:
  2. {
  3. PostQuitMessage(0);
  4. break;
  5. }

PostQuitMessage();

http://msdn.microsoft.com/en-us/libr...45(VS.85).aspx

I hope i did this correctly because last time i tryed to give help i got a warning
Last edited by FTProtocol; Jun 29th, 2008 at 7:22 am.
Reputation Points: -14
Solved Threads: 1
Junior Poster in Training
FTProtocol is offline Offline
99 posts
since May 2008
Jun 29th, 2008
0

Re: exit button

my application is MFC dialog based application
Reputation Points: 10
Solved Threads: 0
Light Poster
lahom is offline Offline
42 posts
since Apr 2008
Jun 29th, 2008
0

Re: exit button

i used
PostMessage(WM_QUIT);
and got
Error: CWinThread::PumpMessage called when not permitted.
could someone explain pleeease
Last edited by Ancient Dragon; Jun 29th, 2008 at 6:43 pm. Reason: disabled smilies
Reputation Points: 10
Solved Threads: 0
Light Poster
lahom is offline Offline
42 posts
since Apr 2008
Jun 29th, 2008
0

Re: exit button

where did you put that PostMessage(). And why didn't you just use PostQuitMessage() as previously suggested?
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: while & if statement
Next Thread in C++ Forum Timeline: New to C++ and need a bit of help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC