1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
| using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
using System.Runtime.InteropServices;
namespace HideBarre
{
public class HideBarre
{
public const int SWP_ASYNCWINDOWPOS = 0x4000;
public const int SWP_DEFERERASE = 0x2000;
public const int SWP_DRAWFRAME = 0x0020;
public const int SWP_FRAMECHANGED = 0x0020;
public const int SWP_HIDEWINDOW = 0x0080;
public const int SWP_NOACTIVATE = 0x0010;
public const int SWP_NOCOPYBITS = 0x0100;
public const int SWP_NOMOVE = 0x0002;
public const int SWP_NOOWNERZORDER = 0x0200;
public const int SWP_NOREDRAW = 0x0008;
public const int SWP_NOREPOSITION = 0x0200;
public const int SWP_NOSENDCHANGING = 0x0400;
public const int SWP_NOSIZE = 0x0001;
public const int SWP_NOZORDER = 0x0004;
public const int SWP_SHOWWINDOW = 0x0040;
public const int HWND_TOP = 0;
public const int HWND_BOTTOM = 1;
public const int HWND_TOPMOST = -1;
public const int HWND_NOTOPMOST = -2;
[DllImport("coredll.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
[DllImport("coredll.dll", EntryPoint = "FindWindowW", SetLastError = true)]
public static extern IntPtr FindWindowW(string lpClassName, string lpWindowName);
public static void HideStartBar()
{
IntPtr handle;
try
{
handle = FindWindowW("HHTaskBar", null);
if (handle != IntPtr.Zero)
{
SetWindowPos((IntPtr)handle, (IntPtr)0, 0, 0, 0, 0, SWP_HIDEWINDOW);
}
}
catch
{
//MessageBox.Show("Impossible d'afficher la barre d'état");
}
}
public static void ShowStartBar()
{
IntPtr handle;
try
{
handle = FindWindowW("HHTaskBar", null);
if (handle != IntPtr.Zero)
{
SetWindowPos(handle, (IntPtr)0, 0,294, 240,26, SWP_SHOWWINDOW);
}
}
catch
{
//MessageBox.Show("Impossible d'afficher la barre d'état");
}
}
}
} |
Partager