Click here to Skip to main content
14,085,057 members
Rate this:
Please Sign up or sign in to vote.
See more:
hi all
I have a MFC MDI c++ program,
And I want to know is it possible to decide about close one of tabs (sure to close MsgBox) ? something similar to oncancel function in dialogue base program.

and also is there a event to close the entire program on closing one of tabs?

thanks for your guides

What I have tried:

I tried ondestroy function for first case but it was not successful
Updated 4-Sep-18 22:21pm
Richard MacCutchan 5-Sep-18 4:12am
You can close any view in an MDI frame. And you can also close the entire program. It is just a matter of writing the code that decides what action to take when the user selects a certain option.
saide_a 5-Sep-18 4:51am
I know, but I want to close the program when special tab of that close.
Richard MacCutchan 5-Sep-18 5:25am
AnD? What is preventing you from closing it?
saide_a 5-Sep-18 7:07am
I want this happen automatically after I close that tab !
Richard MacCutchan 5-Sep-18 8:47am
Well you will need to write some code.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can use the WM_CLOSE message. Use the PostMessage API for it and do all needed operations like saving data and settings before.

You can also use PostQuitMessage.
saide_a 5-Sep-18 4:54am
I checked that but on any return value in Onclose function the destructor of class calls

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190518.1 | Last Updated 5 Sep 2018
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100