Reputation: 11955
For a while now I've used the following Win32 code to Hide the desktop (hide all the desktop Icons). The following is in my Win32_Window class, as the Desktop is just a window.
public bool Visible
{
get { return IsWindowVisible(Handle); }
set
{
ShowWindow(Handle, value ? ShowWindowConsts.SW_SHOW :
ShowWindowConsts.SW_HIDE);
}
}
With Windows 8 the above not only hides the desktop but it makes it go completely blank. Now I suppose that could be considered normal, as the command is to hide, but up until now that hasn't been a problem as the desktop's background image would still be visible (which was the intention).
I've tried this to toggle the icons: https://stackoverflow.com/a/6403014/353147 but it doesn't work in Windows 8.
Anyone found a solution to this?
Upvotes: 16
Views: 1124
Reputation: 3629
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
Upvotes: 1