The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: petezl on January 27, 2005, 03:30:13 AM

Title: Saving on exit
Post by: petezl on January 27, 2005, 03:30:13 AM
Is there a simple solution to the problem of a "Your text has been altered, do you wish to save yes/no" dialog on exit?
I was thinking along the lines of trapping the WM_CHAR message and setting a flag but you could alter the text in the window by using the mouse and >edit>cut. alone, for instance.
I would have thought that there was an api for this but can't find one...
Any thoughts?
Peter.
Title: Re: Saving on exit
Post by: tenkey on January 27, 2005, 05:48:04 AM
Went to MSDN and What!? The built-in Windows controls are under the topic of Windows Shell.

If this is an EDIT control, there is a EM_GETMODIFY message you can send to get this information.

invoke SendMessage, hEditControl, EM_GETMODIFY, 0, 0
invoke SendDlgItemMessage, hWindow, idEditControl, EM_GETMODIFY, 0, 0

EAX = 0, if no changes detected.

Haven't tested it for cut-and-paste.
Title: Re: Saving on exit
Post by: petezl on January 27, 2005, 11:11:56 AM
Thanks Tenkey,  I felt sure that there was going to be an easy solution to this. Just for the life of me couldn't find it.
Peter.
Title: Re: Saving on exit
Post by: pbrennick on January 27, 2005, 06:09:19 PM
petezl,
You need to start searching the API.  This is beginning to be a mantra...

searching the API
searching the API
searching the API
searching the API
searching the API
Paul
Title: Re: Saving on exit
Post by: petezl on January 27, 2005, 06:54:42 PM
Thanks Tenkey, Worked a treat.

Paul, Searching is fine when you have in mind a keyword to search for!
Peter.
Title: Re: Saving on exit
Post by: pbrennick on January 27, 2005, 08:56:26 PM
petezl,
That is very true, I am glad the solution was so close to hand.  Good luck with your project.
Paul