C # use Windows API to hide/display the taskbar (find1_wex, showwindow)

Source: Internet
Author: User

Today, some netizens asked how to display and hide the taskbar?

Here, I will publish a method to display and hide Windows taskbar using Windows API. The Windows taskbar is actually a window, as long as I find the handle of this window, it is easy to show and hide. the taskbar is a window without a title, but its class name isShell_traywndTherefore, you can use findwindow or findwindowex to find its handle, and show and hide the window, using showwindow:

  • Introduction of Windows API Declaration
[Dllimport ("user32.dll", entrypoint = "find1_wex", setlasterror = true)] Static extern intptr find1_wex (intptr hwndparent, intptr success, string lpszclass, string lpszwindow ); [dllimport ("user32.dll", entrypoint = "showwindow", setlasterror = true)] Static extern bool showwindow (intptr hwnd, uint ncmdshow );
  • Display/hide the taskbar window
Intptr trayhwnd = find1_wex (intptr. Zero, intptr. Zero, "shell_traywnd", null); If (trayhwnd! = Intptr. Zero) {showwindow (trayhwnd, 0 );}

In the code above, the second parameter of showwindow,1Display,0Hide

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.