public static IntPtr GetModalWindow(
            IntPtr owner)
        {
            var window = new ModalWindow();

            WindowNative.EnumThreadWindows(
                WindowNative.GetCurrentThreadId(),
                window.EnumChildren, owner);

            return(window.MaxOwnershipHandle);
        }