Detect user closing application window

The windows and Mac versions of my app have the traditional window controls in the corner (minimize, maximize, and close). I’d like to catch the event if they hit the window close icon so that I can ask for a confirmation. Is this possible?


For Windows (Win32 apps) you would need to handle the WM_CLOSE message, and you may be able to stop the process from closing (so it doesn’t send out a WM_QUIT message).

There is plenty of info and examples on the net about how to handle these Windows messages, and perhaps there is something similar for Mac OS X.

1 Like

on MacOS there is a difference between closing a window and exiting an app. I’ve done this before.

Check out this thread

1 Like