Scalabium Software

SMReport Autogenerated
Knowledge for your independence'.
Home Delphi and C++Builder tips


#51: How can I create a shell link (shortcut)?

If you need create a shell link from your application (for example, from you setup app), you can use the next code:

procedure CreateShortCut(ShortCut, Application, Parameters, WorkDir:
string; SW_State: Integer; IconFile: string; IconIndex: Byte);
var
  SCObject: IUnknown;
  SCSLink: IShellLink;
  SCPFile: IPersistFile;
  WFName: WideString;
begin
  SCObject := CreateComObject(CLSID_ShellLink);
  SCSLink := SCObject as IShellLink;
  SCPFile := SCObject as IPersistFile;
  SCSLink.SetPath(PChar(Application));
  SCSLink.SetArguments(PChar(Parameters));
  SCSLink.SetWorkingDirectory(PChar(WorkDir));
  SCSLink.SetShowCmd(SW_State);
  SCSLink.SetIconLocation(PChar(IconFile), IconIndex);
  WFName := ShortCut;
  SCPFile.Save(PWChar(WFName), False);
end;

For example:

CreateShortCut(ShortCut, Application, Parameters, WorkDir: string; SW_State: Integer; IconFile: string; IconIndex: Byte);


Published: December 8, 1999

See also
 
ABA Picture Convert
Paradox to Text converter
Clarion to Text converter/a>
dBase Viewer
Paradox ActiveX
SMImport suite
Paradox Password Recovery
ABA Spreadsheet Convert
DBISAM Viewer
Metafile Convert
 
 


Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2017, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMExport advertising