In Vc++ 6.0 Dialog Based MFC application: I do not want my user close the window by pressing the button [X] in the top-right side of the window itself and also (Alt+F4). I want to display a messageBox ("Do you really want to close the application"); if the user clicks the OK button then the application has to close, else if user clicks the CANCEL button then the application must not be closed.
相关问题
- How to know full paths to DLL's from .csproj f
- Importing NuGet references through a local project
- Visual Studio 2019 - error MSB8020: The build tool
- 'System.Threading.ThreadAbortException' in
- how to call a C++ dll from C# windows application
相关文章
- How to show location of errors, references to memb
- How to track MongoDB requests from a console appli
- Visual Studio Hangs on Loading UI Library
- How to use Mercurial from Visual Studio 2010?
- Copy different file to output directory for releas
- Edit & Continue doesn't work
- “Csc.exe” exited with code -1073741819
- Visual Studio: Is there an incremental search for
You need to implement
OnClose()
and only call the base class'sOnClose()
if you want to quit.Handle the
WM_SYSCOMMAND
message and do something like this in it.Here is how to add WM_SYSCOMMAND Handler to your Code:
Go to ClassView. Right click your dialog class if it is a dialog based application OR your mainframe class if it is a SDI/MDI Application. Click Properties.
In Properties Window, click on the Messages button. Scroll down to WM_SYSCOMMAND and on drop-down combo double-click to add the handler.
OR
You can do it manually as well by adding an entry in the message map. And adding declaration/definition in .h/.cpp respectively.