Hey everybody,
In my program, I would like the user to be warned if he tries to exit without saving the current file. What I'm looking for is a "clean" way to do this. As it stands, I find I have to process WM_SYSCOMMAND for SC_CLOSE and any menu WM_COMMANDs that close the file (and/or application). I'm just wondering if there is *one* spot that would be a good spot for this kind of processing. (I tried throwing it in with WM_DESTROY of the child window which holds the document... but it doesn't seem to work...)

Thanks all
Posted on 2002-05-11 12:53:27 by chorus
WM_CLOSE is a good place for that.... Get's called when ALT-F4 or is pushed.

.if uMsg==WM_CLOSE
cmp FileHandle,0 ;remember to set the FileHandle to zero if File is closed
jz @F
MsgBox, "Do you want to save before quitting?"
cmp eax, IDYES
jnz @@:
do the filesave
Posted on 2002-05-11 13:29:06 by JimmyClif
Thanks JimmyClif, that's one step closer to what I wanted. I just have one objection though... WM_CLOSE doesn't get processed when I choose File/Exit and send the WM_COMMAND to the app... which calls DestroyWindow and sends WM_DESTROY instead of WM_CLOSE... then again... I could just send the WM_CLOSE message instead of DestroyWindow...

sorry... mind's wandering...

Thanks again

Posted on 2002-05-11 13:46:12 by chorus
Yep, just send WM_CLOSE instead :)

Posted on 2002-05-11 13:53:48 by JimmyClif
What about?:

invoke SendMessage,YourEditControlID , EM_GETMODIFY, 0, 0

[b].IF[/b] eax==TRUE
invoke MessageBox, YECID, addr Msg, addr AppName, MB_ICONEXCLAMATION or MB_YESNOCANCEL
[b].IF[/b] ax==IDYES
Exit your program
Posted on 2002-05-11 14:50:47 by CodeLover