X button on windows

I want to use the X button on windows to exit through my command.

Is this possible?

If i do not exit through my command, my program is not terminated correctly and hangs!!!!!!!

[230 byte] By [SOAC] at [2008-1-7]
# 1

what my programming friends say, is the x box cannot be used to exit my exe program

the x box can be disabled, not a good idead.

it is meant to be a windows OS only function, to handle only windows OS calls.

SOAC at 2007-10-2 > top of Msdn Tech,Windows Search Technologies,Windows Desktop Search Development...