//在桌面上建立快捷方式
procedure TForm1.Button1Click(Sender: TObject);
var
tmpObject : IUnknown;
tmpSLink : IShellLink;
tmpPFile : IPersistFile;
PIDL : PItemIDList;
StartupDirectory : array[0..MAX_PATH] of Char;
StartupFilename : String;
LinkFilename : WideString;
begin
StartupFilename := 'c:/windows/notepad.exe';
tmpObject := CreateComObject(CLSID_ShellLink);//创建建立快捷方式的外壳扩展
tmpSLink := tmpObject as IShellLink;//取得接口
tmpPFile := tmpObject as IPersistFile;//用来储存*.lnk文件的接口
tmpSLink.SetPath(pChar(StartupFilename));//设定notepad.exe所在路径
tmpSLink.SetWorkingDirectory(pChar(ExtractFilePath(StartupFilename)));//设定工作目录
SHGetSpecialFolderLocation(0,
CSIDL_DESKTOPDIRECTORY,
PIDL);//获得桌面的Itemidlist
SHGetPathFromIDList(PIDL,
StartupDirectory);//获得桌面路径
LinkFilename := StartupDirectory + '/MyNotepad.lnk';
tmpPFile.Save(pWChar(LinkFilename),FALSE);//保存*.lnk文件
end;
COPY以前的回复的,事实上你问问题前最好搜索一下,省下不少分的