Тема: Ярлык!
Показать сообщение отдельно
  #6  
Старый 05.04.2007, 14:31
Аватар для 4kusNick
4kusNick 4kusNick вне форума
Местный
 
Регистрация: 06.09.2006
Адрес: Россия, Санкт-Петербург
Сообщения: 444
Репутация: 550
По умолчанию

Код:
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, ComCtrls, XPMan, ShellApi, ShlObj, ComObj, ActiveX;
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
procedure CreateLink(sPathObj, sPathLink, sDesc: string);
var
 IObject: IUnknown;
 SLink: IShellLink;
 PFile: IPersistFile;
begin
 IObject := CreateComObject(CLSID_ShellLink);
  SLink := IObject as IShellLink;
 PFile := IObject as IPersistFile;
  with SLink do
  begin
    //SetArguments(PChar(Param));
    SetDescription(PChar(sDesc));
    SetPath(PChar(sPathObj));
 end;
  PFile.Save(PWChar(WideString(sPathLink)), FALSE);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 CreateLink(Application.ExeName,ExtractFilePath(Application.ExeName) + '1.lnk','Description');
end;
end.
__________________
THE CRACKER IS OUT THERE
Ответить с цитированием