I
ili
Unregistered / Unconfirmed
GUEST, unregistred user!
我用一下方法创建桌面快捷方式
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, ShellApi, ShlObj, ActiveX, ComObj, Registry;
......
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;
可我现在想知道桌面上是否已经存在这个快捷方式,该怎么判断?
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, ShellApi, ShlObj, ActiveX, ComObj, Registry;
......
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;
可我现在想知道桌面上是否已经存在这个快捷方式,该怎么判断?