You should be able to open a modal dialog (i.e. created with $dialog()) from the "on exit" event. Even if that dialog displays only "Please wait" to the user, you can do other processing while it's open. Only when the dialog is closed (and the $dialog() call therefore returns) will mIRC actually exit. Similar hack'ish solutions include $input and blocking com object calls (like the various /sleep snippets out there).
Well I haven't tried opening a modal dialog. But I have a /sleep call and it does not prevent mIRC from closing the windows. Honestly though... you should not need a "hack'ish" solution for this.
I'm not sure it should be possible to actually prevent mIRC from closing at all..
You can't prevent someone from forcing a program to quit. Either thru the task manager or some other approach. Indeed... you can create an unbreakable loop that requires a force quit at present. And it also renders the program useless. Interupting the standard exit process thru the on exit event should be possible, since I can see many uses where it would be beneficial.
*NOTE* $input(Hello) does pause the exit process until closed. So I assume using a modal dialog would work. Still once the modal dialog is closed, the application would quit. And while open mIRC is unusable.
One interesting question halting this brings up. Breaking the operation (with cntrl-break) could either resume exiting, or stop the event without quiting. Hmmm...