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-03-18 21:38:42 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-03-18 21:57:50 +0300
commit84503d3af44292d12e80942b22c9f5d6babd85e6 (patch)
treec4f4e46ea5fa8c078334446d186dd12a926fa602 /TaskbarProgress.cs
parent038fa810f90f4c26eeb4539e6f60e6bf7db049a2 (diff)
Should work on all Windows versions now
Diffstat (limited to 'TaskbarProgress.cs')
-rw-r--r--TaskbarProgress.cs19
1 files changed, 14 insertions, 5 deletions
diff --git a/TaskbarProgress.cs b/TaskbarProgress.cs
index 11ecd945..bd957dd4 100644
--- a/TaskbarProgress.cs
+++ b/TaskbarProgress.cs
@@ -1,5 +1,7 @@
using System;
+using System.Diagnostics;
using System.Runtime.InteropServices;
+using System.Windows.Forms;
public static class TaskbarProgress
{
@@ -47,16 +49,23 @@ public static class TaskbarProgress
{
}
- 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)
+ public static void SetState(Form form, TaskbarStates taskbarState)
{
- if (taskbarSupported) taskbarInstance.SetProgressState(windowHandle, taskbarState);
+ if (taskbarSupported)
+ {
+ var taskbarInstance = (ITaskbarList3)new TaskbarInstance();
+ taskbarInstance.SetProgressState(form.Handle, taskbarState);
+ }
}
- public static void SetValue(IntPtr windowHandle, double progressValue, double progressMax)
+ public static void SetValue(Form form, double progressValue, double progressMax)
{
- if (taskbarSupported) taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
+ if (taskbarSupported)
+ {
+ var taskbarInstance = (ITaskbarList3)new TaskbarInstance();
+ taskbarInstance.SetProgressValue(form.Handle, (ulong)progressValue, (ulong)progressMax);
+ }
}
} \ No newline at end of file