Public struct rect
{
Public int left;
Public int
Top;
Public int right;
Public int bottom;
}
Public struct appbardata
{
Public int cbsize;
Public int hwnd;
Public int ucallbackmessage;
Public int
Uedge;
Public rect RC;
Public int lparam;
}
Public const int abs_alwaysontop = 0x002;
Public const int
Abs_autohide = 0x001;
Public const int abs_both = 0x003;
Public const int abm_activate = 0x006;
Public const int abm_getstate
= 0x004;
Public const int abm_gettaskbarpos = 0x005;
Public const int abm_new = 0x000;
Public const int abm_querypos =
0x002;
Public const int abm_setautohidebar = 0x008;
Public
Const int abm_setstate = 0x00a;
///
/// Send a message to the system taskbar
///
[Dllimport ("shell32.dll")]
Public static extern
Int shappbarmessage (INT dwmsg, ref appbardata APP );
[Dllimport ("user32.dll", entrypoint = "findwindow")]
Public static extern int findwindow (string lpclassname, string
Lpwindowname );
///
/// Set whether the system taskbar is automatically hidden
///
///
True is set to Auto Hide, false
Cancel Auto Hide
Public static void setappbarautodisplay (bool
Isauto)
{
Appbardata Abd = new
Appbardata ();
Abd. hwnd = findwindow ("shell_traywnd ",
"");
// Abd. lparam = abs_alwaysontop or abs_autohide
'Automatically hidden and located before the window
// Abd. lparam = abs_alwaysontop
'It is not automatically hidden and is located before the window
// Abd. lparam = abs_autohide
'Automatically hidden, not in front of the window
If (isauto)
{
Abd. lparam = abs_autohide;
Shappbarmessage (abm_setstate, ref
Abd );
}
Else
{
Abd. lparam = abs_alwaysontop;
Shappbarmessage (abm_setstate,
Ref Abd );
}
}
Pass the test in XP and 2003 systems!