| OpenKey(tmp, false); case Location of ST_DESKTOP: sDir :=ReadString('Desktop'); ST_SENDTO: sDir :=ReadString('SendTo'); ST_STARTMENU: sDir :=ReadString('Start Menu'); ST_QUICKLAUNCH: begin sDir :=ReadString('AppData'); sDir :=sDir + '\Microsoft\Internet Explorer\Quick Launch'; end; end; //生成快捷方式文件名 lName :=ChangeFileExt(FileName, '.Lnk'); lName :=ExtractFileName(lName); if sDir<>'' then begin //生成快捷方式全路径名 wFileName :=sDir + '\' + lName; //保存生成的快捷方式文件 pFile.Save(PWChar(wFileName), false); end; Free; end; end; 上面声明了一个过程 下面应用它 var fName :string; fDesc :string; fArgu :string; begin fName :=Application.ExeName; fDesc :='Delphi 7.0 创建的快捷方式--桌面'; fArgu :='无参数'; CreateShortcut(fName,fDesc,fArgu, ST_DESKTOP); end; procedure TForm1.SpeedButton2Click(Sender: TObject); var fName :string; fDesc :string; fArgu :string; |