views:

369

answers:

2

Hi, I wanted to know if there is a way to toggle desktop icon to show/hide when the desktop is double clicked. Similar to how it is done in Stardock Fences. I wanted it to be done using visual c#.

+1  A: 

The second part of your question (when the desktop is double-clicked) is relative simple. You need to install an application-defined hook procedure into a hook chain. Sounds pretty difficult, but is explained in detail in the code sample found here. You may want to download the source here (requires a free account there).

For the first part, the hiding/unhiding of desktop icons, I found several similar code samples like this, however, none seem to work on my pc so you might want to look for another solution to that problem.

Webleeuw
you're right, the last link doesn't seem to work, but thanks anyway for the first 2 links.
murasaki5
A: 

For hiding the desktop icons there is a registry key (have a look here).

I guess you will have to restart your explorer after that to apply the changes by using

  Process[] proc = Process.GetProcessesByName("Explorer");
  foreach(Process p in proc)
   p.Kill();

  Process.Start("explorer.exe");
Bender
using that registry hack will permanently hide the desktop icons. I wanted it to be toggled to show/hide.
murasaki5