Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted
Updated 4-Sep-18 22:21pm
Comments
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

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.
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900