Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
3.67/5 (3 votes)
See more:
Hi,

Some icons on the desktop such as "My computer", "Control Panel", are no different from others. So I want to add this kind of icon to the desktop. How can I implement this?

Also, can this kind of icon can be changed dynamically? e.g. when network connection disabled, the icon shall be changed to the disabled status. :)
Posted
Updated 8-Dec-10 0:24am
v2
Comments
Slacker007 8-Dec-10 5:46am    
@brill: go to your account settings and choose another screen name. Don't use your e-mail address as a screen name. Thank you.

To add a shell icon, you can do the following:

First we create the shell icon.

-- Backup your Registry first.

In the windows registry, go to HKEY_CLASSES_ROOT\CLSID and make a new key named {D46C1FE2-7F18-41D0-6250-848C1D003400}

This name is just an example, other names will work too. Just be sure not to use an existing name and to keep this format.
In the default value of this newly created key, you can put the name you wish to display under the icon. For example, "My test icon".
Create a string named InfoTip and enter some text you wish to display as tooltip when hovering the mouse over the icon.

Under your new key, make a sub key named DefaultIcon. Here you can set the default value to a filename for the icon to display. For example "C:\MyIcon.ico" or "C:\MyDll.dll,5".

Create the following sub keys:
Shell\Open\Command and set the default value to whichever command you wish to execute when the icon is activated. For example "C:\windows\notepad.exe".

You should now have this:
HKEY_CLASSES_ROOT\CLSID
    \{D46C1FE2-7F18-41D0-6250-848C1D003400}
        (default) = "My test icon"
        InfoTip   = "My info tip"
        \DefaultIcon
            (default) = "C:\MyIcon.ico"
        \Shell
            \Open
                \Command
                   (default) = "C:\windows\notepad.exe"


At this point, the shell icon is ready and will have to be added to a place where you can see it.

Go to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop and add a key NameSpace. It may already exist.
Under NameSpace, create a key named {D46C1FE2-7F18-41D0-6250-848C1D003400}.
If you wish to create the icon in the My Computer window rather than on the desktop, you could do the same in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace.

If you want to change the shell icon depending on net connection, you'll have to write a program that monitors the connection and adjusts the shell icon accordingly in the windows register, for example by removing it from the NameSpace.
 
Share this answer
 
v3
Comments
Slacker007 8-Dec-10 6:26am    
@Thaddeus: IMO - I think you should also advise the OP to backup the registry if you are going to recommend a registry settings change.
Slacker007 8-Dec-10 13:12pm    
@Thaddeus: added line about backing up registry first.
Hi,

You can create icon on desktop to create setup with visual studio.

For this you can refer this link.


[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900