g.OpenKey(REG_SHELLFOLDERS,false) then
begin
if SourceFileName<>'''' then
if ShortcutName <>'''' then
LinkName := ShortcutName
else
LinkName := ExtractFileName(SourceFileName)
Else file://当源路径是一个空值时,实际它指向“我的电脑”
LinkName := ''我的电脑'';
MySLink.SetDescription(pchar(LinkName)); file://设置快捷方式描述
LinkName := ChangeFileExt(LinkName,''.lnk''); file://修改扩展名
file://以下通过注册表得到快捷方式的实际建立位置
case ShortcutLocation of
_DESKTOP : Directory := Reg.ReadString(''Desktop'');
_STARTMENU : Directory := Reg.ReadString(''Start Menu'');
_PROGRAMS: Directory := Reg.ReadString(''Programs'');
_STARTUP : Directory := Reg.ReadString(''Startup'');
_QUICKLAUNCH:Directory:=Reg.ReadString(''AppData'')+
''\Microsoft\Internet Explorer\Quick Launch''; file://快速启动栏的路径比较特殊
end;
if Directory <> '''' then
begin
if SubDirectory <> '''' then
begin
SubDir:=Directory + ''\''+ SubDirectory;
WFileName := SubDir + ''\'' + LinkName ;
if not CreateDir(SubDir) then file://创建目录失败
begin
Result:=false;
Exit;
end;
end
else
WFileName := Directory + ''\'' + LinkName;
if MyPFile.Save(PWChar(WFileName),True)<>S_OK then
begin
&n