@@ -23,17 +23,17 @@ endlocal & exit /b %errorlevel%
23
23
24
24
*/
25
25
26
-
27
-
28
-
29
- // Credit: https://stackoverflow.com/a/19024531/388389
30
26
using System;
31
27
using System.Runtime.InteropServices;
32
28
33
29
public class Taskbar
34
30
{
35
31
[DllImport(" user32.dll" )]
36
32
private static extern int FindWindow(string className, string windowText);
33
+
34
+ [DllImport(" user32.dll" )]
35
+ [return: MarshalAs(UnmanagedType.Bool)]
36
+ static extern bool IsWindowVisible(IntPtr hWnd);
37
37
38
38
[DllImport(" user32.dll" )]
39
39
private static extern int ShowWindow(int hwnd, int command);
@@ -82,7 +82,15 @@ public class Taskbar
82
82
ShowWindow(HandleOfStartButton, SW_HIDE);
83
83
}
84
84
85
- static void printHelp()
85
+ public static void GetStatus()
86
+ {
87
+ IntPtr xAsIntPtr = new IntPtr(Handle);
88
+ Console.WriteLine(" TaskBar visible : " + IsWindowVisible(xAsIntPtr));
89
+ xAsIntPtr = new IntPtr(HandleOfStartButton);
90
+ Console.WriteLine(" StartButton visible : " + IsWindowVisible(xAsIntPtr));
91
+ }
92
+
93
+ static void printHelp()
86
94
{
87
95
//clears the extension from the script name
88
96
String scriptName = Environment.GetCommandLineArgs()[0];
@@ -93,8 +101,8 @@ public class Taskbar
93
101
Console.WriteLine(" " + scriptName + " 1" );
94
102
Console.WriteLine(" Show:" );
95
103
Console.WriteLine(" " + scriptName + " 2" );
96
- // Console.WriteLine(" Get State:" );
97
- // Console.WriteLine(" " + scriptName + " 3" );
104
+ Console.WriteLine(" Get State:" );
105
+ Console.WriteLine(" " + scriptName + " 3" );
98
106
}
99
107
100
108
static void Main(string[] args)
@@ -121,9 +129,10 @@ public class Taskbar
121
129
//show
122
130
Taskbar.Show();
123
131
break;
124
- /* case 3:
132
+ case 3:
125
133
// get state
126
- break;*/
134
+ Taskbar.GetStatus();
135
+ break;
127
136
default:
128
137
Console.WriteLine(" Invalid argument: " +args[0]);
129
138
Environment.Exit(10);
0 commit comments