How do I disable file explorer and start menu using C#

Kalpana 286 Reputation points
2021-02-27T16:35:33.233+00:00

Hi

I found this code to disable the task manager and it works like a charm.

        public static void enable()
            {
                RegistryKey objRegistryKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System");
                objRegistryKey.DeleteValue("DisableTaskMgr");
                objRegistryKey.Close();
            }
            public static void disable()
            {
                RegistryKey objRegistryKey = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System");
                if (objRegistryKey.GetValue("DisableTaskMgr") == null)
                    objRegistryKey.SetValue("DisableTaskMgr", "1");

                //RegistryKey regkey;
                //string keyValueInt = "1";
                //string subKey = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System";

                //try
                //{
                //    regkey = Registry.CurrentUser.CreateSubKey(subKey);
                //    regkey.SetValue("DisableTaskMgr", keyValueInt);
                //    regkey.Close();
                //}
                //catch (Exception ex)
                //{
                //    Console.WriteLine(ex.Message);
                //}
            }

I have got a requirement from the user where I have to disable the user from clicking the file explorer, the search box that appears in the taskbar and the start menu.

What registry keys should I use and what are the other options, tweaking registry key and enabling them back seems easier...but I am open to suggestions and advice.. I am not able to find the appropriate keys to disable the file explorer and the others..
Please advice.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,204 questions
{count} votes

Accepted answer
  1. Castorix31 81,461 Reputation points
    2021-02-27T21:24:02.613+00:00

    You can disable Start Menu or other windows with Low Level Hooks (WH_MOUSE_LL + WH_KEYBOARD_LL)

    You return 1 do disable the event (for example when vkCode == Keys.LWin in the Keyboard procedure)

    I don't see what you mean by "clicking the file explorer" (Explorer is the default Shell (Winlogon key))


0 additional answers

Sort by: Most helpful