How to hide desktop icons programmatically?

前端 未结 6 824
陌清茗
陌清茗 2020-11-27 17:34

How can I show/hide the desktop icons programmatically, using C#?

I\'m trying to create an alternative desktop, which uses widgets, and I need to hide the old icons.

6条回答
  •  情深已故
    2020-11-27 18:14

    You can do this in RegEdit HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced change HideIcons to 1

        static void HideIcons()
        {
            RegistryKey myKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced", true);
            if (myKey != null)
            {
                myKey.SetValue("HideIcons", 1);
                myKey.Close();
            }
        }
    

    Use the Registry class as described here.

    http://msdn.microsoft.com/en-us/library/microsoft.win32.registry.aspx

提交回复
热议问题