Basic skills (13) -------- C # code to hide the taskbar, Start Menu, and disable the Task Manager

Source: Internet
Author: User
I. It mainly calls system interfaces and changes the Registry implementation functions.

Ii. Code
Using system; using system. collections. generic; using system. LINQ; using system. text; using system. windows; using system. windows. controls; using system. windows. data; using system. windows. documents; using system. windows. input; using system. windows. media; using system. windows. media. imaging; using system. windows. navigation; using system. windows. shapes; using system. diagnostics; using system. runtime. interopservices; using Microsoft. win32; one-key lock for namespace shutdown {/// <summary> // mainwindow. interaction logic of XAML // </Summary> Public partial class mainwindow: window {public mainwindow () {initializecomponent ();} # region hide and display the taskbar [dllimport ("user32.dll")] public static extern intptr findwindow (string classname, string captionname); [dllimport ("user32.dll")] public static extern bool showwindow (intptr hwnd, uint ncmdshow); // hide the cursor [dllimport ("user32.dll", entrypoint = "showcursor")] public static extern bool showcursor (bool bshow); // showcursor (false); Private void btnhid1_lbar_click (Object sender, routedeventargs E) {// obtain the taskbar and start menu handle var RWL = findwindow ("shell_traywnd", null); var rwl2 = findwindow ("button", null); If (btnhid1_lbar. content = "hide") // when ncmdshow = 0 --- hide; ncmdshow = 1 --- show {showwindow (rwl2, 1); showwindow (RWL, 1 ); showcursor (true); btnhid1_lbar. content = "show";} else {showwindow (rwl2, 0); showwindow (RWL, 0); showcursor (false); btnhid1_lbar. content = "hide" ;}# endregion // disable and enable the Task Manager private void btnmanageform_click (Object sender, routedeventargs e) {If (btnmanageform. content = "disabled") // when ncmdshow = 0 --- hide; ncmdshow = 1 --- display {// disable the local Task Manager registry. setvalue ("HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ System", "disabletaskmgr", 1); // disable the current user Task Manager registry. setvalue ("HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ System", "disabletaskmgr", 1); btnmanageform. content = "enable";} else {// disable the local Task Manager registry. setvalue ("HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ System", "disabletaskmgr", 0); // disable the current user Task Manager registry. setvalue ("HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies \ System", "disabletaskmgr", 0); btnmanageform. content = "disabled ";}}}}
Iii. Postscript

If the Code hides the taskbar and the Start menu, it is still difficult to restore it by using the interface mouse. If you want to use the code, do not use it on others' computers.

Basic skills (13) -------- C # code to hide the taskbar, Start Menu, and disable the Task Manager

Related Article

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.