X button interception

Jun 3, 2009 at 10:29pm
I'm trying to intercept the signal when a user clicks the [X] button to exit the program. I'm almost positive there's an API function that does that somewhere but i'm unable to find it. Does anyone happen to know what it is?

Thanks!
Last edited on Jun 3, 2009 at 10:29pm
Jun 3, 2009 at 10:32pm
OS/platform please.
Jun 3, 2009 at 10:37pm
Oh right, sorry. Windows XP using Dev C++
Jun 4, 2009 at 12:44pm
You need and event handler for the WM_CLOSE message. Here's some reading for you:
http://www.google.com/search?btnI=1&q=msdn+WM_CLOSE
http://www.google.com/search?btnI=1&q=msdn+how+to+terminate+an+application+cleanly+in+win32

Hope this helps.
Jun 5, 2009 at 12:44am
Well...I hate to say it but most of that made no sense to me haha. The Windows API tends to stump me. Is there a short, simple example you could give maybe that's a little more clear than the ones on those sites?
Jun 5, 2009 at 10:35am
you have to write this:

case wm_close:
//your code here
break;

how much short you want?
Last edited on Jun 5, 2009 at 10:38am
Topic archived. No new replies allowed.