Programalama > DELPHI

Etiketler: standart, windows, kisayolu, nun

Ort. 0
Puan ver:
uses ShlObj, ActiveX, ComObj;
...
procedure TForm1.Button1Click(Sender: TObject);
var
  IObject    : IUnknown;
  ISLink     : IShellLink;
  IPFile     : IPersistFile;
  PIDL       : PItemIDList;
  InFolder   : array[0..MAX_PATH] of Char;
  TargetName : String;
  LinkName   : WideString;
begin
  TargetName := 'c:\windows\calc.exe';

  {Use TargetName:=ParamStr(0) which
  returns the path and file name of the
  executing program to create a link to your
  Application}

  IObject := CreateComObject(CLSID_ShellLink);
  ISLink  := IObject as IShellLink;
  IPFile  := IObject as IPersistFile;

  with ISLink do begin
    SetPath(pChar(TargetName));
    SetWorkingDirectory
	   (pChar(ExtractFilePath(TargetName)));
  end;

  // if we want to place a link on the Desktop
  SHGetSpecialFolderLocation
     (0, CSIDL_DESKTOPDIRECTORY, PIDL);
  SHGetPathFromIDList
     (PIDL, InFolder);

  {
   or if we want a link to appear in
   some other, not-so-special, folder:
   InFolder := 'c:\SomeFolder'
  }

  LinkName := InFolder + '\Delphi Created Link.lnk';
  IPFile.Save(PWChar(LinkName), false);
end;



Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2017 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSObil projesidir.