In Windows 7, I use an application which I sometimes close by accident. Is there a way to make Windows issue a "Do you really want to do this" warning when I try to close the application? (It's just a normal Windows application which I usually close by clicking the cross in the upper right corner of the window.)
I don't think you can do it directly using windows, but you could use this small donation ware program to turn off the Close button on windows.
You can still close the program using the File>Exit option if it has one and you would need to add it to your start up to work all the time.
When you click the close button on a normal window, the operating system sends a "window message" to the process that owns that window; for example,
Windows provides a built-in API (part of the Win32 API) which you can use to intercept window messages sent to other windows, even out-of-process. So you could write an external application that does this.
See SetWindowsHookEx routine.