Developer network
>
development tools
>
Development column
>
VB
> Text
Abandon Windows's default icon, let your program you are in the directory of Folder Icon! In fact, it is very simple. In fact, you only need a Desktop.ini file, and I will explain it from two aspects. 1. Manual mode: First create a Desktop.ini file in a folder that needs to be changed, as follows:
[.Shellclassinfo] confirmfileop = 0infotip = I my own folder iconindex = 0ICONFILE = myfolder.ico explanation: Parameters confirmfileop is set to 0 - Prevent users from moving or delete a warning that pops up while popping up this folder . The parameter iconfile is specified as the location of the icon file to be changed, which can be an Icon, BMP, EXE, or DLL file. The icon file in the previous example is also placed in the same directory. The parameter iconIndex can specify the index of the file. If this icon file is an icon file, IconIndex is set to 0. Parameters Infotip is used to set the tooltip in this Folder in WINDOS. Next open the CMD (Command Prompt), enter:
Attrib S i: / myfolder i: / myfolder refers to the path to the icon directory. This operation is to make your folder become a system folder. Ok, after manual processing, the current directory has changed. 2. Programming: This way is to be implemented with the VB I like, and it is also equally Easy. Only two API functions are required, one for operating the establishment of the INI file, the other function is equivalent to Attrib s in the manual mode.
Option ExplicitPrivate Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As LongPrivate Declare Function PathMakeSystemFolder Lib "shlwapi.dll" Alias "PathMakeSystemFolderA" ( BYVAL PSZPATH AS STRING AS LongPrivate Sub Form_Load () 'The following steps are used to create Desktop.ini files, when there is no INI file, you will create INI WritePrivateProfileString ".shellclassInfo", "Confirmfileop", "CONFIRMFILEOP", "0", app.path & "/Desktop.ini" WritePrivateProfileString ".shellclassInfo", "Infotip", "My Folder Things Change", app.path & "/desktop.ini" WritePrivateProfileString ".shellclassInfo", "iconindex", "0" , App.path & "/desktop.ini" WritePrivateProfileString ".shellclassinfo", "iconfile", "myfolder.ico", app.path & "/desktop.ini" let folder becomes system folder PathMakesystemFolder App.Pathend Sub Further illustrative is: WritePrivateProfileString ".shellclassInfo", "iconfile", "myfolder.ico", app.path & "/desktop.ini" can be changed to:
WriteprivateProfileString ".shellclassInfo", "iconfile", app.exename & ".shexe", app.path & "/dtop.ini" If you use the icon of the main window, the index of the icon of the VB compiled program is also Use 0.