How to disable MFC application execution when pressing ESC or ALTF + F4?

I have an MFC application that I do not want to close while running. I turned off the "X" in the upper right corner, but now if I press the ESC or ALT + F4 key, it still closes.

How can I disable this, so it will not be closed if someone pressed these keys? After the program finishes, I want to reuse them.

Thanks
Kampi

+3
source share
2 answers

If you process a message WM_CLOSEand throw it away. (i.e. do not call DefWindowProc), then the window will not be closed.

CS_NOCLOSE, .

+7

Esc, Alt + F4 , Close . OnClose ( ). .

P.S. MFC , 100% . .

+3

Source: https://habr.com/ru/post/1735389/


All Articles