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