Skip to content

Commit 1f2de45

Browse files
authored
Update taskbarHidder.bat
1 parent d4194ba commit 1f2de45

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

hybrids/.net/c/taskbarHidder.bat

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ endlocal & exit /b %errorlevel%
2323

2424
*/
2525

26-
27-
28-
29-
// Credit: https://stackoverflow.com/a/19024531/388389
3026
using System;
3127
using System.Runtime.InteropServices;
3228

3329
public class Taskbar
3430
{
3531
[DllImport("user32.dll")]
3632
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);
3737

3838
[DllImport("user32.dll")]
3939
private static extern int ShowWindow(int hwnd, int command);
@@ -82,7 +82,15 @@ public class Taskbar
8282
ShowWindow(HandleOfStartButton, SW_HIDE);
8383
}
8484

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()
8694
{
8795
//clears the extension from the script name
8896
String scriptName = Environment.GetCommandLineArgs()[0];
@@ -93,8 +101,8 @@ public class Taskbar
93101
Console.WriteLine(" " + scriptName + " 1");
94102
Console.WriteLine("Show:");
95103
Console.WriteLine(" " + scriptName + " 2");
96-
// Console.WriteLine("Get State:");
97-
// Console.WriteLine(" " + scriptName + " 3");
104+
Console.WriteLine("Get State:");
105+
Console.WriteLine(" " + scriptName + " 3");
98106
}
99107

100108
static void Main(string[] args)
@@ -121,9 +129,10 @@ public class Taskbar
121129
//show
122130
Taskbar.Show();
123131
break;
124-
/*case 3:
132+
case 3:
125133
// get state
126-
break;*/
134+
Taskbar.GetStatus();
135+
break;
127136
default:
128137
Console.WriteLine("Invalid argument: "+args[0]);
129138
Environment.Exit(10);

0 commit comments

Comments
 (0)