public TaskbarItemInfo() { if (!DesignerProperties.GetIsInDesignMode(this)) { ITaskbarList taskbarList = null; try { taskbarList = CLSID.CoCreateInstance <ITaskbarList>(CLSID.TaskbarList); taskbarList.HrInit(); // This QI will only work on Win7. _taskbarList = taskbarList as ITaskbarList3; taskbarList = null; } finally { Utility.SafeRelease(ref taskbarList); } _overlaySize = new Size( NativeMethods.GetSystemMetrics(SM.CXSMICON), NativeMethods.GetSystemMetrics(SM.CYSMICON)); } // Set ThumbButtons to an empty list so callers can just use the property. ThumbButtonInfos = new ThumbButtonInfoCollection(); }
public static void DisableWin7TaskbarSupport() { if (TaskBarList == null) { return; } Marshal.ReleaseComObject(TaskBarList); TaskBarList = null; }
private void ShowExplorerWindow(IntPtr tabBarHandle, bool fShow) { if (contextMenuNotifyIcon.InvokeRequired) { contextMenuNotifyIcon.Invoke(new Action(() => ShowExplorerWindow(tabBarHandle, fShow))); return; } Instance inst; if (!dicNotifyIcon.TryGetValue(tabBarHandle, out inst)) { return; } ITaskbarList o = null; try { object obj2; Guid rclsid = ExplorerGUIDs.CLSID_TaskbarList; Guid riid = ExplorerGUIDs.IID_ITaskbarList; PInvoke.CoCreateInstance(ref rclsid, IntPtr.Zero, 1, ref riid, out obj2); o = (ITaskbarList)obj2; o.HrInit(); if (fShow) { dicNotifyIcon.Remove(tabBarHandle); o.AddTab(inst.ExplorerHandle); PInvoke.ShowWindow(inst.ExplorerHandle, inst.ShowWindowCode); PInvoke.SetForegroundWindow(inst.ExplorerHandle); notifyIcon.Visible = dicNotifyIcon.Count > 0; } else { PInvoke.ShowWindow(inst.ExplorerHandle, 0); o.DeleteTab(inst.ExplorerHandle); notifyIcon.Visible = true; } UpdateContextMenu(); if (notifyIcon.Visible) { int count = dicNotifyIcon.Count; notifyIcon.Text = count == 1 ? QTUtility.TextResourcesDic["TrayIcon"][0] : string.Format(QTUtility.TextResourcesDic["TrayIcon"][1], count); } } catch (Exception exception) { QTUtility2.MakeErrorLog(exception); } finally { if (o != null) { Marshal.ReleaseComObject(o); } } }
public TaskbarExtension(System.Windows.Forms.Form form) { Com.CoCreateInstance(CLSID_TaskbarList, IntPtr.Zero, Com.CLSCTX_ALL, typeof(ITaskbarList).GUID, out pTaskbarList); if (pTaskbarList == IntPtr.Zero) { throw new Exception(); } taskbar = Marshal.GetTypedObjectForIUnknown(pTaskbarList, typeof(ITaskbarList)) as ITaskbarList; this.form = form; WM_TBC = RegisterWindowMessage("TaskbarButtonCreated"); }
public static void EnableWin7TaskbarSupport() { if (TaskBarList != null) { return; } if (IsOSWindows7OrNewer) { WM_TASKBAR_BUTTON_CREATED = User32.RegisterWindowMessage("TaskbarButtonCreated"); TaskBarList = (ITaskbarList)Activator.CreateInstance <TaskbarList>(); } }
public ProcessController(IMainFormView view) { Application.ApplicationExit += ApplicationOnApplicationExit; _taskbarList = (ITaskbarList)new CoTaskbarList(); _taskbarList.HrInit(); _view = view; _startProcessingEvent = new AutoResetEvent(false); _startProcessThread = new Thread(StartProcessWorker); _startProcessThread.Start(); }
public TaskbarItemInfo() { if (!DesignerProperties.GetIsInDesignMode(this)) { ITaskbarList taskbarList = null; try { taskbarList = CLSID.CoCreateInstance <ITaskbarList>("56FDF344-FD6D-11d0-958A-006097C9A090"); taskbarList.HrInit(); this._taskbarList = (taskbarList as ITaskbarList3); taskbarList = null; } finally { Utility.SafeRelease <ITaskbarList>(ref taskbarList); } this._overlaySize = new Size((double)NativeMethods.GetSystemMetrics(SM.CXSMICON), (double)NativeMethods.GetSystemMetrics(SM.CYSMICON)); } this.ThumbButtonInfos = new ThumbButtonInfoCollection(); }
public TaskbarItemInfo() { if (!DesignerProperties.GetIsInDesignMode(this)) { ITaskbarList taskbarList = null; try { taskbarList = CLSID.CoCreateInstance <ITaskbarList>(CLSID.TaskbarList); taskbarList.HrInit(); _taskbarList = taskbarList as ITaskbarList3; taskbarList = null; } finally { Utility.SafeRelease(ref taskbarList); } _overlaySize = new Size(NativeMethods.GetSystemMetrics(SM.CXSMICON), NativeMethods.GetSystemMetrics(SM.CYSMICON)); } ThumbButtonInfos = new ThumbButtonInfoCollection(); }
public TaskbarManager() { if (!IsTaskbarSupported) { return; } ITaskbarList _taskbarList = null; try { _taskbarList = (ITaskbarList)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid(CLSID.TaskbarList))); _taskbarList.HrInit(); // This QI will only work on Win7. taskbarList = (ITaskbarList3)_taskbarList; _taskbarList = null; } finally { Utilities.SafeRelease(ref _taskbarList); } }
static UInt32 HrInitNotImplemented(ITaskbarList _) { return(E_NOTIMPL); }
public TaskBar() { isWin7 = (Environment.OSVersion.Version.Major > 6) || (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor >= 1); if (isWin7) TaskbarList = (ITaskbarList)new TaskbarList(); }
public static void EnableWin7TaskbarSupport() { if(_taskBarList != null) return; if(IsOSWindows7OrNewer) { WM_TASKBAR_BUTTON_CREATED = User32.RegisterWindowMessage("TaskbarButtonCreated"); _taskBarList = (ITaskbarList)Activator.CreateInstance<TaskbarList>(); } }
public static void DisableWin7TaskbarSupport() { if(_taskBarList == null) return; Marshal.ReleaseComObject(_taskBarList); _taskBarList = null; }