如何将外壳图标添加到桌面

问题描述:



桌面上的某些图标,例如我的电脑",控制面板",与其他图标没有什么不同.因此,我想将这种图标添加到桌面.我该如何实施?

另外,可以动态更改这种图标吗?例如当网络连接禁用时,该图标应更改为禁用状态. :)

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. :)

要添加外壳图标,您可以执行以下操作:

首先,我们创建外壳图标.

-首先备份您的注册表.

在Windows注册表中,转到HKEY_CLASSES_ROOT\CLSID并创建一个名为{D46C1FE2-7F18-41D0-6250-848C1D003400}
的新密钥.
该名称仅是示例,其他名称也可以使用.只要确保不使用现有名称并保持此格式即可.
在此新创建的键的默认值中,可以将要显示的名称放在图标下.例如我的测试图标".
创建一个名为InfoTip的字符串,并在将鼠标悬停在图标上时输入一些您希望显示为工具提示的文本.

在新密钥下,创建一个名为DefaultIcon的子密钥.您可以在此处将默认值设置为文件名以显示图标.例如"C:\ MyIcon.ico"或"C:\ MyDll.dll,5".

创建以下子项:
Shell\Open\Command并将默认值设置为激活图标后希望执行的命令.例如"C:\ windows \ notepad.exe".

您现在应该拥有这个:
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"



此时,外壳图标已准备就绪,必须将其添加到可以看到它的地方.

转到HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop并添加键NameSpace.它可能已经存在.
NameSpace下,创建一个名为{D46C1FE2-7F18-41D0-6250-848C1D003400}的密钥.
如果希望在我的电脑"窗口中而不是在桌面上创建图标,则可以在HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace中进行相同的操作.

如果要根据网络连接来更改外壳图标,则必须编写一个程序来监视连接并在Windows寄存器中相应地调整外壳图标,例如通过从NameSpace中将其删除.



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.




您可以在桌面上创建图标以使用Visual Studio创建设置.

为此,您可以参考此链接.


[^ ]
Hi,

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

For this you can refer this link.


[^]