当鼠标点击桌面上的图标时,比如点击“我的电脑”,然后在我的程序中修改它的名称,我知道注册表中的clsid值,现在的问题是我在程序中怎样识别哪个快捷方式是“我的电脑”。 下面的代码是列举所有的桌面上的快捷方式,每个快捷方式都保存在一个itemidlist结构中,我现在想在程序中修改“我的电脑”的名称,怎么改啊,我找不到是什么函数有这个功能。请大家帮忙啊。
var
cids: cardinal ;
id:pitemidlist;
str:_strret;
pname: LPWSTR;
n:string;
sqlstr:string;
FileInfo: TSHFileInfo;
begin
hr:=SHGetDesktopFolder(folder);
folder.EnumObjects(form1.handle,SHCONTF_FOLDERS or SHCONTF_NONFOLDERS, ids);
id:=@itemidlist;
cids:=0;
hr:=ids.Next(1,id, cids);
cou:=1;
iml.Clear;
while(hr=noerror) do
begin
hr:=folder.GetDisplayNameOf(id,SHGDN_NORMAL or SHGDN_INFOLDER, str );
hr:=ids.Next(1,id,cids);
end;
var
cids: cardinal ;
id:pitemidlist;
str:_strret;
pname: LPWSTR;
n:string;
sqlstr:string;
FileInfo: TSHFileInfo;
begin
hr:=SHGetDesktopFolder(folder);
folder.EnumObjects(form1.handle,SHCONTF_FOLDERS or SHCONTF_NONFOLDERS, ids);
id:=@itemidlist;
cids:=0;
hr:=ids.Next(1,id, cids);
cou:=1;
iml.Clear;
while(hr=noerror) do
begin
hr:=folder.GetDisplayNameOf(id,SHGDN_NORMAL or SHGDN_INFOLDER, str );
hr:=ids.Next(1,id,cids);
end;
{________________________________________________
| Mycaption:快捷方式标题 |
| TargetName:快捷方式指向的文件,需包含完整路径| |
| DispInfo:快捷方式提示信息 可为空 |
| win2000指向快捷方式时可显示win98下无用 |
|________________________________________________}
var
IObject : IUnknown;
ISLink : IShellLink;
IPFile : IPersistFile;
PIDL : PItemIDList;
InFolder : array[0..MAX_PATH] of Char;
TargetName : String;
LinkName : WideString;
begin
if not fileexists(TargetName) then Exit;
if mycaption='' then Exit;
IObject := CreateComObject(CLSID_ShellLink);
ISLink := IObject as IShellLink;
IPFile := IObject as IPersistFile;
with ISLink do begin
SetPath(pChar(TargetName));
SetWorkingDirectory
(pChar(ExtractFilePath(TargetName)));
SetDescription(pchar(DispInfo));
end;
// 在桌面上建立
SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, PIDL);
SHGetPathFromIDList(PIDL, InFolder);
LinkName := InFolder '\' mycaption '.lnk';
IPFile.Save(PWChar(LinkName), false);
//在程序组中建立
SHGetSpecialFolderLocation(0,CSIDL_STARTMENU , PIDL);
SHGetPathFromIDList(PIDL, InFolder);
LinkName := InFolder '\程序\' mycaption '.lnk';
IPFile.Save(PWChar(LinkName), false);
result:=true;
end;
9217, "My Network Places" 这是“网上邻居”
9218, "Entire Network"
9219, "5? Floppy"
9220, "3? Floppy"
9221, "Removable Disk"
9222, "Internet Explorer" 这是“IE浏览器”
9223, "%1!ls! on '%2!ls!'"
9224, "%1!ls! (%2!c!:)"
9225, "5.25 Floppy"
9226, "3.5 Floppy"
9227, "My Documents" 这是“我的文档”
9228, "(%2!c!:) %1!ls!"
9231, "Floppy"建议你修改前先用ResHacker工具打开shell32.dll研究一下它的资源内容。补充:修改系统文件时,通常系统都会提示并建议用户还原,具体怎么关闭提示的方法网上有的,自自找找。
改右边default的值
显示桌面系统图标
[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}]
@="计算机"[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit]
"LastKey"="计算机"[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu]
"{20D04FE0-3AEA-1069-A2D8-08002B30309D}"=dword:00000000 ;计算机[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel]
"{20D04FE0-3AEA-1069-A2D8-08002B30309D}"=dword:00000000 ;计算机[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache]
"@C:\\WINDOWS\\system32\\SHELL32.dll,-9216"="计算机"