Как создать ShortCut файл (.LNK)?
Falk0ner, вс, 06/07/2008 - 15:34.
uses ShlObj, ActiveX, ComObj;
...
{©Drkb v.3(2007): <a href="http://www.drkb.ru" title="www.drkb.ru">www.drkb.ru</a>,
®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 v.3(2007): <a href="http://www.drkb.ru" title="www.drkb.ru">www.drkb.ru</a>,
®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;
Автор: Vit (www.delphist.com, www.drkb.ru, www.unihighlighter.com, www.nevzorov.org)
Взято с Vingrad.ru http://forum.vingrad.ru
Отправить комментарий