Is there a way to halt an on exit?

like when u press the "X" button on the top right of mIRC, it will halt?

Code:
on *:exit: {
halt
<open custom dialog>
}


I tried to halt it using mIRC 6.14 but it don't work