The Windows taskbar is actually a form without a title, so you only need to find this form to hide and display it.
[Dllimport ("user32.dll", entrypoint = "find?wex", setlasterror = true)] <br/> static extern intptr values (intptr hwndparent, intptr values, string lpszclass, string lpszwindow ); </P> <p> [dllimport ("user32.dll", entrypoint = "showwindow", setlasterror = true)] <br/> static extern bool showwindow (intptr hwnd, uint ncmdshow); </P> <p> private void button#click (Object sender, eventargs E) <br/>{< br/> intptr trayhwnd = find1_wex (intptr. zero, intptr. zero, "shell_traywnd", null); // find the first subwindow that matches the specified condition in the window list, if no value is found, 0 is returned. <br/> // intptr trayhwnd = findwindow ("shell_traywnd", null); // you can find the first top-level window in the window list that meets the specified conditions, use the API function getwindowtext to obtain the name of the window <br/>/* hwnd <br/> the handle of the window to change the show status. <br/> ncmdshow <br/> exactly one of the following flags specifying how to show the wi Ndow: </P> <p> sw_hide = 0 <br/> hide the window. <br/> sw_maximize = 3 <br/> maximize the window. <br/> sw_minimize = 6 <br/> minimize the window. <br/> sw_restore = 9 <br/> restore the window (not maximized nor minimized ). <br/> sw_show = 5 <br/> show the window. <br/> sw_showmaximized = 3 <br/> show the window maximized. <br/> sw_showminimized = 2 <br/> show the window minimized. <br/> sw_showminnoactive = 7 <B R/> show the window minimized but do not activate it. <br/> sw_showna = 8 <br/> show the window in its current state but do not activate it. <br/> sw_shownoactivate = 4 <br/> show the window in its most recent size and position but do not activate it. <br/> sw_shownormal = 1 <br/> show the window and activate it (as usual ). */<br/> If (button1.text = "hide") <br/>{< br/> If (trayhwnd! = Intptr. zero) <br/>{< br/> showwindow (trayhwnd, 0); <br/> button1.text = "show "; <br/>}</P> <p >}< br/> else <br/>{< br/> showwindow (trayhwnd, 1 ); <br/> button1.text = "hide"; <br/>}< br/>}