ISandboxManager::GetActiveLock

More advanced version of CanLeaveSandbox if you want to find out the reason why the sandbox cannot be left.