X button interception

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
OS/platform please.
Oh right, sorry. Windows XP using Dev C++
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.
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?
you have to write this:

case wm_close:
//your code here
break;

how much short you want?
Last edited on
Topic archived. No new replies allowed.