Home > Software engineering >  A modal dialog box close button call OnCancel questions (" X ")
A modal dialog box close button call OnCancel questions (" X ")

Time:04-08

VS2015, MDI application, to use a non-modal dialog, find the dialog IDCANCEL button, the ESC key, the window in the top right corner of the "X" button, the actual calls OnCancel virtual functions, confirmed that the window in the top right corner of the "X" button, will trigger WM_CLOSE message, call OnClose method, said Microsoft's official documentation OnClose DestroyWindow default method calls, but I looked through the VC 2015 with MFC source code, or to find a CDialog CDialogEx response WM_CLOSE message calls OnCancel code implementation, which have been familiar with this, find the modal dialog window close button at top right corner of the "X" is to call OnCancel evidence? The official document or the MFC source code file that can be,

CodePudding user response:

The fork can modify (remove WS_SYSMENU) style,
Or registered style plus CS_NOCLOSE
Or message can process WM_SYSCOMMAND SC_CLOSE






  • Related