Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-02-10 06:17:02 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-02-10 06:17:02 +0300
commitfdc2bdf8d29395be2667d3ad61530d7bca48f14c (patch)
treeece62e96b13120966a76828da1cd3b7c9dd65878 /TaskbarProgress.cs
parentfa792620678d69714daec0bb87d63a47122727ba (diff)
Fixes + свистелки и перделки
Diffstat (limited to 'TaskbarProgress.cs')
-rw-r--r--TaskbarProgress.cs62
1 files changed, 62 insertions, 0 deletions
diff --git a/TaskbarProgress.cs b/TaskbarProgress.cs
new file mode 100644
index 00000000..11ecd945
--- /dev/null
+++ b/TaskbarProgress.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Runtime.InteropServices;
+
+public static class TaskbarProgress
+{
+ public enum TaskbarStates
+ {
+ NoProgress = 0,
+ Indeterminate = 0x1,
+ Normal = 0x2,
+ Error = 0x4,
+ Paused = 0x8
+ }
+
+ [ComImportAttribute()]
+ [GuidAttribute("ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf")]
+ [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
+ private interface ITaskbarList3
+ {
+ // ITaskbarList
+ [PreserveSig]
+ void HrInit();
+ [PreserveSig]
+ void AddTab(IntPtr hwnd);
+ [PreserveSig]
+ void DeleteTab(IntPtr hwnd);
+ [PreserveSig]
+ void ActivateTab(IntPtr hwnd);
+ [PreserveSig]
+ void SetActiveAlt(IntPtr hwnd);
+
+ // ITaskbarList2
+ [PreserveSig]
+ void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
+
+ // ITaskbarList3
+ [PreserveSig]
+ void SetProgressValue(IntPtr hwnd, UInt64 ullCompleted, UInt64 ullTotal);
+ [PreserveSig]
+ void SetProgressState(IntPtr hwnd, TaskbarStates state);
+ }
+
+ [GuidAttribute("56FDF344-FD6D-11d0-958A-006097C9A090")]
+ [ClassInterfaceAttribute(ClassInterfaceType.None)]
+ [ComImportAttribute()]
+ private class TaskbarInstance
+ {
+ }
+
+ private static ITaskbarList3 taskbarInstance = (ITaskbarList3)new TaskbarInstance();
+ private static bool taskbarSupported = Environment.OSVersion.Version >= new Version(6, 1);
+
+ public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
+ {
+ if (taskbarSupported) taskbarInstance.SetProgressState(windowHandle, taskbarState);
+ }
+
+ public static void SetValue(IntPtr windowHandle, double progressValue, double progressMax)
+ {
+ if (taskbarSupported) taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
+ }
+} \ No newline at end of file