Как создать ShortCut файл (.LNK)?

Previous  Top  Next

    
 

 

 

Code:

uses ShlObj, ActiveX, ComObj;

...

{©Drkb v.3(2007): www.drkb.ru,

®Vit (Vitaly Nevzorov) - nevzorov@yahoo.com}

 

procedure CreateShortCut(ShortCutName, Parameters, FileName: string);

var ShellObject: IUnknown;

ShellLink: IShellLink;

PersistFile: IPersistFile;

FName: WideString;

begin

ShellObject := CreateComObject(CLSID_ShellLink);

ShellLink := ShellObject as IShellLink;

PersistFile := ShellObject as IPersistFile;

with ShellLink do

   begin

     SetArguments(PChar(Parameters));

     SetPath(PChar(FileName));

     SetWorkingDirectory(PChar(extractfilepath(FileName)));

     FName := ShortCutName;

     PersistFile.Save(PWChar(FName), False);

   end;

end;

 

 

 

©Drkb::01748

Автор: Vit (www.delphist.com, www.drkb.ru, www.unihighlighter.com, www.nevzorov.org)

Взято с Vingrad.ru http://forum.vingrad.ru