public static ISystemWindow GetSystemWindow (IntPtr handle, EmbeddingOptions options) {
			if ((options & EmbeddingOptions.ForcedPopup) == EmbeddingOptions.ForcedPopup) {
				return new SystemWindowPopup(handle, options);
			}
			if ((options & EmbeddingOptions.ForcedEmbedded) == EmbeddingOptions.ForcedEmbedded) {
				return new SystemWindowEmbedded(handle, options);
			}
			if ((options & EmbeddingOptions.DontClip) == EmbeddingOptions.DontClip) {
				return new SystemWindowPopup(handle, options);
			}
			if ((options & EmbeddingOptions.DontSaveTransparency) == EmbeddingOptions.DontSaveTransparency) {
				return new SystemWindowEmbedded(handle, options);
			}
			uint exStyle = WinAPI.GetWindowLongPtr(handle, WinAPI.GWL.EXSTYLE);
			if ((exStyle & WinAPI.WS_EX.LAYERED) != WinAPI.WS_EX.LAYERED) {
				return new SystemWindowEmbedded(handle, options);
			}
			if ((options & EmbeddingOptions.BestCrossPlatformness) == EmbeddingOptions.BestCrossPlatformness) {
				return new SystemWindowPopup(handle, options);
			}
			if ((options & EmbeddingOptions.BestPerformance) == EmbeddingOptions.BestPerformance) {
				if (Environment.OSVersion.Version.Major == 6 &&
					Environment.OSVersion.Version.Minor == 2) {
					return new SystemWindowTransp8(handle, options & ~EmbeddingOptions.DontSaveMenu);
				}
				else {
					return new SystemWindowPopup(handle, options);
				}
			}
			throw new Exception();
		}
		protected SystemWindow (IntPtr handle, EmbeddingOptions options) {
			Handle = handle;
			_handleRef = new HandleRef(this, Handle);
			_originalStyle = WinAPI.GetWindowLongPtr(Handle, WinAPI.GWL.STYLE);
			_originalExStyle = WinAPI.GetWindowLongPtr(Handle, WinAPI.GWL.EXSTYLE);
			WinAPI.RECT rect;
			WinAPI.GetWindowRect(_handleRef, out rect);
			_originalPosition = new WinAPI.Position(rect);
			_embeddingOptions = options;
		}
		//---------------------------------------------------------------------
		public void Init (IntPtr dependentWindowHandle, Window window,
				EmbeddingOptions options = EmbeddingOptions.BestPerformance) {
			IntPtr handle = (new WindowInteropHelper(window)).Handle;
			if (_childDispatchers.All(fhs => fhs.Handle != handle)) {
				_childDispatcher = new ChildWindowsDispatcher(handle, window);
				_childDispatchers.Add(_childDispatcher);
				HwndSource source = PresentationSource.FromVisual(window) as HwndSource;
				source.AddHook(_childDispatcher.WndProc);
			}
			else {
				_childDispatcher = _childDispatchers.First(fhs => fhs.Handle == handle);
			}
			if (_systemWindow != null && _grabbed) {
				Release();
				_systemWindow = SystemWindow.GetSystemWindow(dependentWindowHandle, options);
				Grab();
			}
			else {
				_systemWindow = SystemWindow.GetSystemWindow(dependentWindowHandle, options);
			}
		}
		public SystemWindowTransp8 (IntPtr handle, EmbeddingOptions options) : base(handle, options) { }
		public SystemWindowPopup (IntPtr handle, EmbeddingOptions options) : base(handle, options) {
		}
		public SystemWindowEmbedded (IntPtr handle, EmbeddingOptions options) : base(handle, options) {
			if ((options & EmbeddingOptions.DontSaveMenu) == EmbeddingOptions.DontSaveMenu ||
					WinAPI.GetMenu(handle) == IntPtr.Zero) {
				_childStyle = true;
			}
		}