You can check with $appactive if mIRC is active or not.