If delaying the FreeLibrary() is all it will take, I'll implement that. However mIRC will still call the UnloadDll() during the WM_CLOSE event.