Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29253 Discussions

stop to save before exit the program

kooka
Beginner
739 Views

Hi buddies, im in the last steps of a large program, this is a combined quickwin and win32 project, now im dealing with the exit in the program. The thing is that i want to ask to the user to save changes before leave the program, when i pick the X in the right upper boundary. I undesrtad that event sends a wm_destroy message, i can pause the program in that message and display a dialog box asking for saving, but next, the program exits, and i dont want to, i yust want to stop exit. I read and note that alsouse a postquit function that sends a wm_quit message,I tried to stop the program in wm_quit message but couldn'tdo it, so i think that when itry to stop via wm_destroy message is too late.Does anybody knows how to stop exit message.

Thanks!!

0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
739 Views
Handle WM_CLOSE for the main window. If you don't want it closed (i.e. MessageBox returns IDCANCEL), don't call DefWindowProc.

(DefWindowProc will call DestroyWindow on WM_CLOSE, which in turn will generate WM_DESTROY, but, as you noted, it's too late then). WM_QUIT comes even later.
0 Kudos
kooka
Beginner
739 Views
oh, thanks man!, it works. you always havethe answer!
0 Kudos
Reply