![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Создание ярлыков [D5, Win95/98]
GIL © (2002-10-29 23:16:00)Большая просьба не игнорировать и не отсылать ко всяким там RTFM.
Как создавать ярлыки, если в примере будет использоваться тип IpersistFile, то просьба указать где он лежит, потому что в модуле ShlObj есть только упоминание о нем в виде ремарка. Если с помощью rundll32, то просьба привести конкретный работающий пример, т.к. пробовал - не получилось. Примеры лучше на Delphi, в крайнем случае на Assembler. Заранее спасибо.
Призрак (2002-10-30 11:36:00) [1]Нашел, кажется, в FAQ fido7.ru.delphi.
RTFM, RTFM, и RTFM.
procedure CreateLink(LNKPath, // LNK file location
CommandLine, // command line to execute
Args, // command line arguments
WorkDir, // working directory
IconLocation, // icon filename for shortcut
ShortCutName // shortcut name (LNK filename)
: String);
var IObj: IUnknown;
Link: IShellLink;
IPFile: IPersistFile;
TargetW: WideString;
begin
CoInitialize(nil);
IObj := CreateComObject(CLSID_ShellLink);
if IObj = nil then Exit;
Link := IObj as IShellLink;
IPFile := IObj as IPersistFile;
with Link do begin
SetPath(PChar(CommandLine));
SetArguments(PChar(Args));
SetShowCmd(SW_SHOWNORMAL);
SetWorkingDirectory(PChar(WorkDir));
SetIconLocation(PChar(IconLocation),0);
SetDescription(PChar(ShortCutName));
end;
TargetW := LNKPath+"\"+ShortCutName+".lnk";
IPFile.Save(PWChar(TargetW), False);
CoUnInitialize;
end;
Рыжик (2002-10-30 08:48:00) [2]IPersistFile лежит в ActiveX, IShellLink в ShlObj.