private void DisableSets(object sender, RoutedEventArgs e) { int value = 0; DwmInterop.DwmSetWindowAttribute(new WindowInteropHelper(this).Handle, DwmInterop.DWMWA_TABBING_ENABLED, ref value, Marshal.SizeOf <int>()); }
private void GetInfo(IntPtr hwnd) { var sb = new StringBuilder(260); var parent = hwnd; while (parent != IntPtr.Zero) { hwnd = parent; parent = GetParent(hwnd); } GetWindowText(hwnd, sb, 255); DwmInterop.DwmGetUnmetTabRequirements(hwnd, out var requirements); var results = Enum.GetValues(typeof(DwmInterop.DWM_TAB_WINDOW_REQUIREMENTS)) .Cast <DwmInterop.DWM_TAB_WINDOW_REQUIREMENTS>() .Where(e => (requirements & e) == e) .Select(e => new { Label = e.ToString(), Description = DwmMessages.Messages[e] }); Results.ItemsSource = Enumerable.Range(0, 1).Select(_ => new { Label = "WindowName", Description = sb.ToString() }).Concat(results); }
private void Window1_Loaded(object sender, RoutedEventArgs e) { var value = _tabEnabled ? 1 : 0; var preferred = _preferred; var handle = new WindowInteropHelper(this).Handle; var parent = new WindowInteropHelper(_parent).Handle; DwmInterop.DwmSetWindowAttribute(handle, DwmInterop.DWMWA_TABBING_ENABLED, ref value, Marshal.SizeOf <int>()); DwmInterop.DwmSetWindowAttribute(handle, DwmInterop.DWMWA_TAB_GROUPING_PREFERENCE, ref preferred, Marshal.SizeOf <int>()); DwmInterop.DwmSetWindowAttribute(handle, DwmInterop.DWMWA_ASSOCIATED_WINDOW, ref parent, IntPtr.Size); }