Quote:
At dll loading (/dll plugin.dll Start) I subclass the current channel window with my own WndProc. When I later remove this subclass in UnloadDll, direct call "/dll -u plugin.dll" causes immediate termination of mIRC. However if I remove the subclass in some other function before unloading dll (/dll plugin.dll Stop; /dll -u plugin.dll), everything is fine.

This means that Windows is sending messages related the subclass when you unload it. You will need to follow the steps you have described: remove the subclass first, return control to mIRC to allow it to process any Windows messages, and then unload the DLL.