怎样在桌面上建立快捷图标和程序组?请教各位高手。急!急!!(100分)

  • 主题发起人 abclililove
  • 开始时间
A

abclililove

Unregistered / Unconfirmed
GUEST, unregistred user!
在自制安装程序过程中,怎样在桌面上建立快捷图标和程序组?请教各位高手,不胜感激。
 
你用的是什么安装程序制作工具?
 
我用的是SetupBuilder Professional 1.50sc,在里边有加快捷图标和程序组的选项,
非常方便的,可以试试啊
 
procedure TFormAbout.SetLink(linkfile, programfile: string);
var
Reg: TRegIniFile;
WFileName: WideString;
AnObj: IUnKnown;
Shlink: IShellLink;
PFile: IPersistFile;
begin
AnObj := CreateComObject(CLSID_ShellLink);
shLink := AnObj as IShellLink;
PFile := AnObj as IPersistFile;
shLink.SetWorkingDirectory(PChar(ProgramFile));
programfile:=programfile+'/iFORM.exe';
shLink.SetPath(PChar(programfile));
Reg := TRegIniFile.Create('Software/MicroSoft/Windows/CurrentVersion/Explorer');
WFileName := Reg.ReadString('Shell Folders', 'Desktop', '') + '/' + linkfile + '.lnk';
PFile.Save(PWChar(WFileName), True);
Reg.Free;
end;

procedure XXX;
begin
SetLink('SoftName',ExtractFileDir(Application.exename));
end;
 
yaya8163,我按你的做了,不过在桌面上形成的只是一个以任何方式可打开的无图标形式,
并没有连接到应用程序,还请多指教。
 
function CreateShellLink(SAppName:string;SLinkName:string='';
ifolder:Integer=0;
SSubFolder:string='';SDescription:string=''):string;
//创建快捷方式
{快捷方式文件夹
CSIDL_DESKTOP = $0000;
CSIDL_PROGRAMS = $0002;
CSIDL_CONTROLS = $0003;
CSIDL_PRINTERS = $0004;
CSIDL_PERSONAL = $0005;
CSIDL_FAVORITES = $0006;
CSIDL_STARTUP = $0007;
CSIDL_RECENT = $0008;
CSIDL_SENDTO = $0009;
CSIDL_STARTMENU = $000b;
CSIDL_DESKTOPDIRECTORY = $0010;
CSIDL_FONTS = $0014;
CSIDL_TEMPLATES = $0015;
CSIDL_COMMON_STARTMENU = $0016;
CSIDL_COMMON_PROGRAMS = $0017;
CSIDL_COMMON_STARTUP = $0018;
CSIDL_COMMON_DESKTOPDIRECTORY = $0019;
}
var
SL: IShellLink;
PF: IPersistFile;
FileName: WideString;
FilePath: array[0..MAX_PATH] of char;
begin
try
OleCheck(CoCreateInstance(CLSID_ShellLink, nil,
CLSCTX_INPROC_SERVER,IShellLink, SL));
PF:=SL as IPersistFile;
OleCheck(SL.SetPath(PChar(SAppName)));
if SDescription <> '' then
SL.SetDescription(PChar(SDescription));
if SLinkName='' then
SLinkName:=ExtractFileName(SAppName);
SHGetSpecialFolderPath(0,FilePath,IFolder,True);
FileName:=string(FilePath);
if SSubFolder<>'' then
begin
FileName:=FileName+'/'+SSubFolder;
if not DirectoryExists(FileName) then
CreateDir(FileName);
end;
FileName:=FileName+'/'+SLinkName+'.lnk';
PF.Save(PWideChar(FileName), True);
Result:=FileName;
except
Result:='';
end;
end;
 
看这里
http://www.delphibbs.com/delphibbs/dispq.asp?lid=417173
http://www.delphibbs.com/delphibbs/dispq.asp?lid=606683
http://www.delphibbs.com/delphibbs/dispq.asp?lid=96903
 
http://www.puusheng.com/bbs/index.php?sid=a4f3e6c7cd4495747e874fc75ffde424
 
用 My Inno Setup Extensions 3.06
http://www.wintax.nl/isx/
有源代码
 
顶部