I've read your previous posts on the issue and did take a look at my code to see if this is possible, unfortunately it's not that simple...

Many routines are called to cleanup/save settings/etc. when mIRC exits; going through all of them to make sure that they work in the WM_DESTROY event will take quite a bit of work after years of designing everything so that it works properly in the WM_CLOSE event. I can't simply assume that they will all work unfortunately... one issue that comes to mind is that the main mIRC window is hidden by WM_DESTROY before mIRC receives it, resulting in mIRC being unable to save mIRC's display state.

Since mIRC closes DLLs in a specific order during cleanup to enable the DLLs access to mIRC's current state, I can't simply move just the closing of DLLs to WM_DESTROY.

Is there no way for your DLL to safely remove the WNDPROC when mIRC calls the UnloadDLL routine?