Take the 2-minute tour ×  How can I show/hide the desktop icons
programatically, using C#?  I'm trying to create an alternative
desktop, which uses widgets, and I need to hide the old icons.
share|improve this question add comment  3 Answers  up vote 11
down vote accepted  You can do this using the Windows API. Here
is sample code in C# that will toggle desktop icons.
[DllImport("user32.dll", SetLastError = true)] static extern
IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", SetLastError = true)] static extern
IntPtr GetWindow(IntPtr hWnd, GetWindow_Cmd uCmd);     enum
GetWindow_Cmd : uint         GW_HWNDFIRST = 0,
GW_HWNDLAST = 1,         GW_HWNDNEXT = 2,         GW_HWNDPREV =
3,         GW_OWNER = 4,         GW_CHILD = 5,
[DllImport("user32.dll", CharSet = CharSet.Auto)] static extern
IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam,
IntPtr lParam);      private const int WM_COMMAND = 0x111;
static void ToggleDesktopIcons()         var