private void addWindow(ApplicationWindow win) { if (!Windows.Contains(win)) { Windows.Add(win); } }
private ApplicationWindow addWindow(IntPtr hWnd, ApplicationWindow.WindowState initialState = ApplicationWindow.WindowState.Inactive, bool sanityCheck = false) { ApplicationWindow win = new ApplicationWindow(hWnd, this); // set window state if a non-default value is provided if (initialState != ApplicationWindow.WindowState.Inactive) { win.State = initialState; } // add window unless we need to validate it is eligible to show in taskbar if (!sanityCheck || win.CanAddToTaskbar) { Windows.Add(win); } // Only send TaskbarButtonCreated if we are shell, and if OS is not Server Core // This is because if Explorer is running, it will send the message, so we don't need to // Server Core doesn't support ITaskbarList, so sending this message on that OS could cause some assuming apps to crash if (Interop.Shell.IsCairoRunningAsShell && !Interop.Shell.IsServerCore) { SendNotifyMessage(win.Handle, (uint)TASKBARBUTTONCREATEDMESSAGE, UIntPtr.Zero, IntPtr.Zero); } return(win); }
private void initialize() { IsStarting = true; try { CairoLogger.Instance.Debug("Starting WindowsTasksService"); // create window to receive task events _HookWin = new NativeWindowEx(); _HookWin.CreateHandle(new CreateParams()); // prevent other shells from working properly SetTaskmanWindow(_HookWin.Handle); // register to receive task events RegisterShellHookWindow(_HookWin.Handle); WM_SHELLHOOKMESSAGE = RegisterWindowMessage("SHELLHOOK"); WM_TASKBARCREATEDMESSAGE = RegisterWindowMessage("TaskbarCreated"); TASKBARBUTTONCREATEDMESSAGE = RegisterWindowMessage("TaskbarButtonCreated"); _HookWin.MessageReceived += ShellWinProc; // set window for ITaskbarList setTaskbarListHwnd(); // adjust minimize animation SetMinimizedMetrics(); // prepare collections groupedWindows = CollectionViewSource.GetDefaultView(Windows); groupedWindows.GroupDescriptions.Add(new PropertyGroupDescription("Category")); groupedWindows.CollectionChanged += groupedWindows_Changed; groupedWindows.Filter = groupedWindows_Filter; var taskbarItemsView = groupedWindows as ICollectionViewLiveShaping; taskbarItemsView.IsLiveFiltering = true; taskbarItemsView.LiveFilteringProperties.Add("ShowInTaskbar"); taskbarItemsView.IsLiveGrouping = true; taskbarItemsView.LiveGroupingProperties.Add("Category"); // enumerate windows already opened EnumWindows(new CallBackPtr((hwnd, lParam) => { ApplicationWindow win = new ApplicationWindow(hwnd, this); if (win.ShowInTaskbar && !Windows.Contains(win)) { Windows.Add(win); } return(true); }), 0); // register for app grabber changes so that our app association is accurate AppGrabber.AppGrabber.Instance.CategoryList.CategoryChanged += CategoryList_CategoryChanged; } catch (Exception ex) { CairoLogger.Instance.Info("Unable to start WindowsTasksService: " + ex.Message); } IsStarting = false; }
private void addWindow(ApplicationWindow win) { if (win.ShowInTaskbar && !Windows.Contains(win)) { Windows.Add(win); } }
private void getInitialWindows() { EnumWindows((hwnd, lParam) => { ApplicationWindow win = new ApplicationWindow(hwnd); // set window category if provided by shell win.Category = TaskCategoryProvider?.GetCategory(win); if (win.CanAddToTaskbar && win.ShowInTaskbar && !Windows.Contains(win)) { Windows.Add(win); } return(true); }, 0); IntPtr hWndForeground = GetForegroundWindow(); if (Windows.Any(i => i.Handle == hWndForeground && i.ShowInTaskbar)) { ApplicationWindow win = Windows.First(wnd => wnd.Handle == hWndForeground); win.State = ApplicationWindow.WindowState.Active; win.SetShowInTaskbar(); } }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { Window = DataContext as WindowsTasks.ApplicationWindow; Window.PropertyChanged += Window_PropertyChanged; if (!ListMode) { setIconSize(); setToolTip(); } else { // Task list display changes btn.Style = FindResource("CairoTaskListButtonStyle") as Style; pbProgress.Style = FindResource("TaskListProgressBar") as Style; ToolTipService.SetPlacement(btn, System.Windows.Controls.Primitives.PlacementMode.Right); WinTitle.TextAlignment = TextAlignment.Left; imgIcon.Margin = new Thickness(3, 0, 6, 0); } // drag support - delayed activation using system setting dragTimer = new DispatcherTimer { Interval = SystemParameters.MouseHoverTime }; dragTimer.Tick += dragTimer_Tick; // thumbnails - delayed activation using system setting thumbTimer = new DispatcherTimer { Interval = SystemParameters.MouseHoverTime }; thumbTimer.Tick += thumbTimer_Tick; }
public void CloseWindow(ApplicationWindow window) { if (window.Close() != IntPtr.Zero) { CairoLogger.Instance.Debug($"Removing window {window.Title} from collection due to no response"); window.Dispose(); TasksService.Instance.Windows.Remove(window); } }
private void UncloakEventCallback(IntPtr hWinEventHook, uint eventType, IntPtr hWnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime) { if (hWnd != IntPtr.Zero && idObject == 0 && idChild == 0) { if (Windows.Any(i => i.Handle == hWnd)) { ApplicationWindow win = Windows.First(wnd => wnd.Handle == hWnd); win.Uncloak(); } } }
private void removeWindow(IntPtr hWnd) { if (Windows.Any(i => i.Handle == hWnd)) { do { ApplicationWindow win = Windows.First(wnd => wnd.Handle == hWnd); win.Dispose(); Windows.Remove(win); }while (Windows.Any(i => i.Handle == hWnd)); } }
private bool groupedWindows_Filter(object item) { ApplicationWindow window = item as ApplicationWindow; if (window.ShowInTaskbar) { return(true); } else { return(false); } }
private void CollectionViewSource_Filter(object sender, System.Windows.Data.FilterEventArgs e) { WindowsTasks.ApplicationWindow window = e.Item as WindowsTasks.ApplicationWindow; if (window.ShowInTaskbar) { e.Accepted = true; } else { e.Accepted = false; } }
private void removeWindow(ApplicationWindow win) { if (this.Windows.Contains(win)) { do { if (Configuration.Settings.EnableTaskbarPolling) { win.VisCheck.Stop(); } this.Windows.Remove(win); }while (this.Windows.Contains(win)); } }
private void initialize() { IsStarting = true; try { CairoLogger.Instance.Debug("Starting WindowsTasksService"); // create window to receive task events _HookWin = new NativeWindowEx(); _HookWin.CreateHandle(new CreateParams()); // prevent other shells from working properly SetTaskmanWindow(_HookWin.Handle); // register to receive task events RegisterShellHookWindow(_HookWin.Handle); WM_SHELLHOOKMESSAGE = RegisterWindowMessage("SHELLHOOK"); _HookWin.MessageReceived += ShellWinProc; // adjust minimize animation SetMinimizedMetrics(); // prepare collections groupedWindows = CollectionViewSource.GetDefaultView(Windows); groupedWindows.GroupDescriptions.Add(new PropertyGroupDescription("Category")); groupedWindows.CollectionChanged += groupedWindows_Changed; groupedWindows.Filter = groupedWindows_Filter; var taskbarItemsView = groupedWindows as ICollectionViewLiveShaping; taskbarItemsView.IsLiveFiltering = true; taskbarItemsView.LiveFilteringProperties.Add("ShowInTaskbar"); // enumerate windows already opened EnumWindows(new CallBackPtr((hwnd, lParam) => { ApplicationWindow win = new ApplicationWindow(hwnd, this); if (win.ShowInTaskbar && !Windows.Contains(win)) { this.Windows.Add(win); } return(true); }), 0); } catch (Exception ex) { Debug.Print(ex.Message); } IsStarting = false; }
private void initialize() { IsStarting = true; try { Trace.WriteLine("Starting WindowsTasksService"); // create window to receive task events _HookWin = new NativeWindowEx(); _HookWin.CreateHandle(new CreateParams()); // prevent other shells from working properly SetTaskmanWindow(_HookWin.Handle); // register to receive task events RegisterShellHookWindow(_HookWin.Handle); WM_SHELLHOOKMESSAGE = RegisterWindowMessage("SHELLHOOK"); _HookWin.MessageReceived += ShellWinProc; // adjust minimize animation SetMinimizedMetrics(); // enumerate windows already opened EnumWindows(new CallBackPtr((hwnd, lParam) => { ApplicationWindow win = new ApplicationWindow(hwnd, this); if (win.ShowInTaskbar && !Windows.Contains(win)) { this.Windows.Add(win); } return(true); }), 0); } catch (Exception ex) { Debug.Print(ex.Message); } IsStarting = false; }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { Window = DataContext as WindowsTasks.ApplicationWindow; Window.PropertyChanged += Window_PropertyChanged; if (!ListMode) { switch (Configuration.Settings.Instance.TaskbarIconSize) { case 0: imgIcon.Width = 32; imgIcon.Height = 32; break; case 10: imgIcon.Width = 24; imgIcon.Height = 24; break; default: imgIcon.Width = 16; imgIcon.Height = 16; break; } } else { // Task list display changes btn.Style = FindResource("CairoTaskListButtonStyle") as Style; ToolTipService.SetPlacement(btn, System.Windows.Controls.Primitives.PlacementMode.Right); WinTitle.TextAlignment = TextAlignment.Left; imgIcon.Margin = new Thickness(3, 0, 6, 0); } // drag support - delayed activation using system setting dragTimer = new DispatcherTimer { Interval = SystemParameters.MouseHoverTime }; dragTimer.Tick += dragTimer_Tick; }
public void Initialize() { try { Trace.WriteLine("Starting WindowsTasksService"); _HookWin = new NativeWindowEx(); _HookWin.CreateHandle(new CreateParams()); NativeMethods.SetTaskmanWindow(_HookWin.Handle); //'Register to receive shell-related events NativeMethods.RegisterShellHookWindow(_HookWin.Handle); //'Assume no error occurred WM_SHELLHOOKMESSAGE = NativeMethods.RegisterWindowMessage("SHELLHOOK"); _HookWin.MessageReceived += ShellWinProc; SetMinimizedMetrics(); //int msg = NativeMethods.RegisterWindowMessage("TaskbarCreated"); IntPtr ptr = new IntPtr(0xffff); //IntPtr hDeskWnd = NativeMethods.GetDesktopWindow(); //NativeMethods.SendMessageTimeout(ptr, (uint)msg, IntPtr.Zero, IntPtr.Zero, 2, 200, ref ptr); //NativeMethods.SendMessageTimeout(hDeskWnd, 0x0400, IntPtr.Zero, IntPtr.Zero, 2, 200, ref hDeskWnd); NativeMethods.EnumWindows(new NativeMethods.CallBackPtr((hwnd, lParam) => { ApplicationWindow win = new ApplicationWindow(hwnd, this); if (win.ShowInTaskbar && !Windows.Contains(win)) { this.Windows.Add(win); } return(true); }), 0); } catch (Exception ex) { Debug.Print(ex.Message); } }
private void ShellWinProc(Message msg) { if (msg.Msg == WM_SHELLHOOKMESSAGE) { try { var win = new ApplicationWindow(msg.LParam, this); lock (this._windowsLock) { switch (msg.WParam.ToInt32()) { case HSHELL_WINDOWCREATED: Trace.WriteLine("Created: " + msg.LParam.ToString()); addWindow(win); break; case HSHELL_WINDOWDESTROYED: Trace.WriteLine("Destroyed: " + msg.LParam.ToString()); removeWindow(win); break; case HSHELL_WINDOWREPLACING: Trace.WriteLine("Replacing: " + msg.LParam.ToString()); if (this.Windows.Contains(win)) { win = this.Windows.First(wnd => wnd.Handle == msg.LParam); win.State = ApplicationWindow.WindowState.Inactive; win.OnPropertyChanged("ShowInTaskbar"); } else { win.State = ApplicationWindow.WindowState.Inactive; addWindow(win); } break; case HSHELL_WINDOWREPLACED: Trace.WriteLine("Replaced: " + msg.LParam.ToString()); removeWindow(win); break; case HSHELL_WINDOWACTIVATED: case HSHELL_RUDEAPPACTIVATED: Trace.WriteLine("Activated: " + msg.LParam.ToString()); foreach (var aWin in this.Windows.Where(w => w.State == ApplicationWindow.WindowState.Active)) { aWin.State = ApplicationWindow.WindowState.Inactive; } if (msg.LParam != IntPtr.Zero) { if (this.Windows.Contains(win)) { win = this.Windows.First(wnd => wnd.Handle == msg.LParam); win.State = ApplicationWindow.WindowState.Active; win.OnPropertyChanged("ShowInTaskbar"); } else { win.State = ApplicationWindow.WindowState.Active; addWindow(win); } foreach (ApplicationWindow wind in this.Windows) { if (wind.WinFileName == win.WinFileName) { wind.OnPropertyChanged("ShowInTaskbar"); } } } break; case HSHELL_FLASH: Trace.WriteLine("Flashing window: " + msg.LParam.ToString()); if (this.Windows.Contains(win)) { win = this.Windows.First(wnd => wnd.Handle == msg.LParam); win.State = ApplicationWindow.WindowState.Flashing; } else { win.State = ApplicationWindow.WindowState.Flashing; addWindow(win); } break; case HSHELL_ACTIVATESHELLWINDOW: Trace.WriteLine("Activate shell window called."); break; case HSHELL_ENDTASK: Trace.WriteLine("EndTask called: " + msg.LParam.ToString()); removeWindow(win); break; case HSHELL_GETMINRECT: Trace.WriteLine("GetMinRect called: " + msg.LParam.ToString()); SHELLHOOKINFO winHandle = (SHELLHOOKINFO)Marshal.PtrToStructure(msg.LParam, typeof(SHELLHOOKINFO)); winHandle.rc = new RECT { bottom = 100, left = 0, right = 100, top = 0 }; Marshal.StructureToPtr(winHandle, msg.LParam, true); msg.Result = winHandle.hwnd; break; case HSHELL_REDRAW: Trace.WriteLine("Redraw called: " + msg.LParam.ToString()); if (this.Windows.Contains(win)) { win = this.Windows.First(wnd => wnd.Handle == msg.LParam); win.OnPropertyChanged("ShowInTaskbar"); win.OnPropertyChanged("Title"); win.SetIcon(); foreach (ApplicationWindow wind in this.Windows) { if (wind.WinFileName == win.WinFileName) { wind.OnPropertyChanged("ShowInTaskbar"); win.OnPropertyChanged("Title"); win.SetIcon(); } } } break; // TaskMan needs to return true if we provide our own task manager to prevent explorers. // case HSHELL_TASKMAN: // Trace.WriteLine("TaskMan Message received."); // break; default: Trace.WriteLine("Unknown called: " + msg.LParam.ToString() + " Message " + msg.Msg.ToString()); if (this.Windows.Contains(win)) { win = this.Windows.First(wnd => wnd.Handle == msg.LParam); win.OnPropertyChanged("ShowInTaskbar"); win.OnPropertyChanged("Title"); win.SetIcon(); } break; } } } catch (Exception ex) { Trace.WriteLine("Exception: " + ex.ToString()); Debugger.Break(); } } msg.Result = DefWindowProc(msg.HWnd, msg.Msg, msg.WParam, msg.LParam); }
private void initialize() { try { CairoLogger.Instance.Debug("Starting WindowsTasksService"); // create window to receive task events _HookWin = new NativeWindowEx(); _HookWin.CreateHandle(new CreateParams()); // prevent other shells from working properly SetTaskmanWindow(_HookWin.Handle); // register to receive task events RegisterShellHookWindow(_HookWin.Handle); WM_SHELLHOOKMESSAGE = RegisterWindowMessage("SHELLHOOK"); WM_TASKBARCREATEDMESSAGE = RegisterWindowMessage("TaskbarCreated"); TASKBARBUTTONCREATEDMESSAGE = RegisterWindowMessage("TaskbarButtonCreated"); _HookWin.MessageReceived += ShellWinProc; if (Interop.Shell.IsWindows8OrBetter) { // set event hook for uncloak events uncloakEventProc = UncloakEventCallback; if (uncloakEventHook == IntPtr.Zero) { uncloakEventHook = SetWinEventHook( EVENT_OBJECT_UNCLOAKED, EVENT_OBJECT_UNCLOAKED, IntPtr.Zero, uncloakEventProc, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); } } // set window for ITaskbarList setTaskbarListHwnd(); // adjust minimize animation SetMinimizedMetrics(); // prepare collections groupedWindows = CollectionViewSource.GetDefaultView(Windows); groupedWindows.GroupDescriptions.Add(new PropertyGroupDescription("Category")); groupedWindows.CollectionChanged += groupedWindows_Changed; groupedWindows.Filter = groupedWindows_Filter; if (groupedWindows is ICollectionViewLiveShaping taskbarItemsView) { taskbarItemsView.IsLiveFiltering = true; taskbarItemsView.LiveFilteringProperties.Add("ShowInTaskbar"); taskbarItemsView.IsLiveGrouping = true; taskbarItemsView.LiveGroupingProperties.Add("Category"); } // enumerate windows already opened EnumWindows(new CallBackPtr((hwnd, lParam) => { ApplicationWindow win = new ApplicationWindow(hwnd, this); if (win.CanAddToTaskbar && win.ShowInTaskbar && !Windows.Contains(win)) { Windows.Add(win); } return(true); }), 0); // register for app grabber changes so that our app association is accurate AppGrabber.AppGrabber.Instance.CategoryList.CategoryChanged += CategoryList_CategoryChanged; } catch (Exception ex) { CairoLogger.Instance.Info("Unable to start WindowsTasksService: " + ex.Message); } }
private void ShellWinProc(System.Windows.Forms.Message msg) { if (msg.Msg == WM_SHELLHOOKMESSAGE) { try { var win = new ApplicationWindow(msg.LParam, this); lock (this._windowsLock) { switch (msg.WParam.ToInt32()) { case HSHELL_WINDOWCREATED: Trace.WriteLine("Created: " + msg.LParam.ToString()); Windows.Add(win); break; case HSHELL_WINDOWDESTROYED: Trace.WriteLine("Destroyed: " + msg.LParam.ToString()); if (this.Windows.Contains(win)) { this.Windows.Remove(win); } break; case HSHELL_WINDOWREPLACING: case HSHELL_WINDOWREPLACED: Trace.WriteLine("Replaced: " + msg.LParam.ToString()); if (this.Windows.Contains(win)) { win = this.Windows.First(wnd => wnd.Handle == msg.LParam); win.State = ApplicationWindow.WindowState.Inactive; } else { win.State = ApplicationWindow.WindowState.Inactive; Windows.Add(win); } break; case HSHELL_WINDOWACTIVATED: case HSHELL_RUDEAPPACTIVATED: Trace.WriteLine("Activated: " + msg.LParam.ToString()); foreach (var aWin in this.Windows.Where(w => w.State == ApplicationWindow.WindowState.Active)) { aWin.State = ApplicationWindow.WindowState.Inactive; } if (msg.LParam == IntPtr.Zero) { break; } if (this.Windows.Contains(win)) { win = this.Windows.First(wnd => wnd.Handle == msg.LParam); win.State = ApplicationWindow.WindowState.Active; } else { win.State = ApplicationWindow.WindowState.Active; Windows.Add(win); } break; case HSHELL_FLASH: Trace.WriteLine("Flashing window: " + msg.LParam.ToString()); if (this.Windows.Contains(win)) { win = this.Windows.First(wnd => wnd.Handle == msg.LParam); win.State = ApplicationWindow.WindowState.Flashing; } else { win.State = ApplicationWindow.WindowState.Flashing; Windows.Add(win); } break; case HSHELL_ACTIVATESHELLWINDOW: Trace.WriteLine("Activeate shell window called."); break; case HSHELL_ENDTASK: Trace.WriteLine("EndTask called."); break; case HSHELL_GETMINRECT: Trace.WriteLine("GetMinRect called."); SHELLHOOKINFO winHandle = (SHELLHOOKINFO)Marshal.PtrToStructure(msg.LParam, typeof(SHELLHOOKINFO)); winHandle.rc.Top = 0; winHandle.rc.Left = 0; winHandle.rc.Bottom = 100; winHandle.rc.Right = 100; Marshal.StructureToPtr(winHandle, msg.LParam, true); msg.Result = winHandle.hwnd; break; case HSHELL_REDRAW: Trace.WriteLine("Redraw called."); this.OnRedraw(msg.LParam); break; // TaskMan needs to return true if we provide our own task manager to prevent explorers. // case HSHELL_TASKMAN: // Trace.WriteLine("TaskMan Message received."); // break; default: Trace.WriteLine("Uknown called. " + msg.Msg.ToString()); break; } } } catch (Exception ex) { Trace.WriteLine("Exception: " + ex.ToString()); Debugger.Break(); } } }
private void ShellWinProc(Message msg) { if (msg.Msg == WM_SHELLHOOKMESSAGE) { try { lock (_windowsLock) { switch ((HSHELL)msg.WParam.ToInt32()) { case HSHELL.WINDOWCREATED: CairoLogger.Instance.Debug("Created: " + msg.LParam.ToString()); if (!Windows.Any(i => i.Handle == msg.LParam)) { addWindow(msg.LParam); } else { ApplicationWindow win = Windows.First(wnd => wnd.Handle == msg.LParam); win.UpdateProperties(); } break; case HSHELL.WINDOWDESTROYED: CairoLogger.Instance.Debug("Destroyed: " + msg.LParam.ToString()); removeWindow(msg.LParam); break; case HSHELL.WINDOWREPLACING: CairoLogger.Instance.Debug("Replacing: " + msg.LParam.ToString()); if (Windows.Any(i => i.Handle == msg.LParam)) { ApplicationWindow win = Windows.First(wnd => wnd.Handle == msg.LParam); win.State = ApplicationWindow.WindowState.Inactive; win.SetShowInTaskbar(); } else { addWindow(msg.LParam); } break; case HSHELL.WINDOWREPLACED: CairoLogger.Instance.Debug("Replaced: " + msg.LParam.ToString()); removeWindow(msg.LParam); break; case HSHELL.WINDOWACTIVATED: case HSHELL.RUDEAPPACTIVATED: CairoLogger.Instance.Debug("Activated: " + msg.LParam.ToString()); foreach (var aWin in Windows.Where(w => w.State == ApplicationWindow.WindowState.Active)) { aWin.State = ApplicationWindow.WindowState.Inactive; } if (msg.LParam != IntPtr.Zero) { ApplicationWindow win = null; if (Windows.Any(i => i.Handle == msg.LParam)) { win = Windows.First(wnd => wnd.Handle == msg.LParam); win.State = ApplicationWindow.WindowState.Active; win.SetShowInTaskbar(); } else { win = addWindow(msg.LParam, ApplicationWindow.WindowState.Active); } if (win != null) { foreach (ApplicationWindow wind in Windows) { if (wind.WinFileName == win.WinFileName) { wind.SetShowInTaskbar(); } } } } break; case HSHELL.FLASH: CairoLogger.Instance.Debug("Flashing window: " + msg.LParam.ToString()); if (Windows.Any(i => i.Handle == msg.LParam)) { ApplicationWindow win = Windows.First(wnd => wnd.Handle == msg.LParam); win.State = ApplicationWindow.WindowState.Flashing; } else { addWindow(msg.LParam, ApplicationWindow.WindowState.Flashing, true); } break; case HSHELL.ACTIVATESHELLWINDOW: CairoLogger.Instance.Debug("Activate shell window called."); break; case HSHELL.ENDTASK: CairoLogger.Instance.Debug("EndTask called: " + msg.LParam.ToString()); removeWindow(msg.LParam); break; case HSHELL.GETMINRECT: CairoLogger.Instance.Debug("GetMinRect called: " + msg.LParam.ToString()); SHELLHOOKINFO winHandle = (SHELLHOOKINFO)Marshal.PtrToStructure(msg.LParam, typeof(SHELLHOOKINFO)); winHandle.rc = new Interop.NativeMethods.Rect { Bottom = 100, Left = 0, Right = 100, Top = 0 }; Marshal.StructureToPtr(winHandle, msg.LParam, true); msg.Result = winHandle.hwnd; return; // return here so the result isnt reset to DefWindowProc case HSHELL.REDRAW: CairoLogger.Instance.Debug("Redraw called: " + msg.LParam.ToString()); if (Windows.Any(i => i.Handle == msg.LParam)) { ApplicationWindow win = Windows.First(wnd => wnd.Handle == msg.LParam); win.UpdateProperties(); foreach (ApplicationWindow wind in Windows) { if (wind.WinFileName == win.WinFileName) { wind.UpdateProperties(); } } } else { addWindow(msg.LParam, ApplicationWindow.WindowState.Inactive, true); } break; // TaskMan needs to return true if we provide our own task manager to prevent explorers. // case HSHELL.TASKMAN: // SingletonLogger.Instance.Info("TaskMan Message received."); // break; default: break; } } } catch (Exception ex) { CairoLogger.Instance.Error("Error in ShellWinProc. ", ex); Debugger.Break(); } } else if (msg.Msg == WM_TASKBARCREATEDMESSAGE) { CairoLogger.Instance.Debug("TaskbarCreated received, setting ITaskbarList window"); setTaskbarListHwnd(); } else { // Handle ITaskbarList functions, most not implemented yet ApplicationWindow win = null; switch (msg.Msg) { case (int)WM.USER + 50: // ActivateTab // Also sends WM_SHELLHOOK message CairoLogger.Instance.Debug("ITaskbarList: ActivateTab HWND:" + msg.LParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 60: // MarkFullscreenWindow CairoLogger.Instance.Debug("ITaskbarList: MarkFullscreenWindow HWND:" + msg.LParam + " Entering? " + msg.WParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 64: // SetProgressValue CairoLogger.Instance.Debug("ITaskbarList: SetProgressValue HWND:" + msg.WParam + " Progress: " + msg.LParam); win = new ApplicationWindow(msg.WParam, this); if (Windows.Contains(win)) { win = Windows.First(wnd => wnd.Handle == msg.WParam); win.ProgressValue = (int)msg.LParam; } msg.Result = IntPtr.Zero; return; case (int)WM.USER + 65: // SetProgressState CairoLogger.Instance.Debug("ITaskbarList: SetProgressState HWND:" + msg.WParam + " Flags: " + msg.LParam); win = new ApplicationWindow(msg.WParam, this); if (Windows.Contains(win)) { win = Windows.First(wnd => wnd.Handle == msg.WParam); win.ProgressState = (TBPFLAG)msg.LParam; } msg.Result = IntPtr.Zero; return; case (int)WM.USER + 67: // RegisterTab CairoLogger.Instance.Debug("ITaskbarList: RegisterTab MDI HWND:" + msg.LParam + " Tab HWND: " + msg.WParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 68: // UnregisterTab CairoLogger.Instance.Debug("ITaskbarList: UnregisterTab Tab HWND: " + msg.WParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 71: // SetTabOrder CairoLogger.Instance.Debug("ITaskbarList: SetTabOrder HWND:" + msg.WParam + " Before HWND: " + msg.LParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 72: // SetTabActive CairoLogger.Instance.Debug("ITaskbarList: SetTabActive HWND:" + msg.WParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 75: // Unknown CairoLogger.Instance.Debug("ITaskbarList: Unknown HWND:" + msg.WParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 76: // ThumbBarAddButtons CairoLogger.Instance.Debug("ITaskbarList: ThumbBarAddButtons HWND:" + msg.WParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 77: // ThumbBarUpdateButtons CairoLogger.Instance.Debug("ITaskbarList: ThumbBarUpdateButtons HWND:" + msg.WParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 78: // ThumbBarSetImageList CairoLogger.Instance.Debug("ITaskbarList: ThumbBarSetImageList HWND:" + msg.WParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 79: // SetOverlayIcon - Icon CairoLogger.Instance.Debug("ITaskbarList: SetOverlayIcon - Icon HWND:" + msg.WParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 80: // SetThumbnailTooltip CairoLogger.Instance.Debug("ITaskbarList: SetThumbnailTooltip HWND:" + msg.WParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 81: // SetThumbnailClip CairoLogger.Instance.Debug("ITaskbarList: SetThumbnailClip HWND:" + msg.WParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 85: // SetOverlayIcon - Description CairoLogger.Instance.Debug("ITaskbarList: SetOverlayIcon - Description HWND:" + msg.WParam); msg.Result = IntPtr.Zero; return; case (int)WM.USER + 87: // SetTabProperties CairoLogger.Instance.Debug("ITaskbarList: SetTabProperties HWND:" + msg.WParam); msg.Result = IntPtr.Zero; return; } } msg.Result = DefWindowProc(msg.HWnd, msg.Msg, msg.WParam, msg.LParam); }