Solved

Create a Shortcut

Posted on 2004-10-10
6
436 Views
Last Modified: 2010-04-05
hi, I need to know how 2 create a shortcut with all the fields.

Name: name the link
Target: direct 2 the file
Start in: the folder that the link should start in
shortcut key: quick shortcut key
Run: how will the program startup. normal max, min..
Comment: this is a brief description of the link
Command: this goes after the target file.

can anyone do this? its urgent, 500pts up for grabs, maybe 1000pts if u get it 2 me within 1-2hrs

Sal.
0
Comment
Question by:SaLz
6 Comments
 
LVL 7

Assisted Solution

by:sftweng
sftweng earned 100 total points
ID: 12271000
0
 
LVL 6

Assisted Solution

by:Amir Azhdari
Amir Azhdari earned 300 total points
ID: 12271041
procedure CreateShortcut(FileName: string; MenuFolder: string);
var
 AnObj: IUnknown;
 ShLink: IShellLink;
 PFile: IPersistFile;
 WFileName: WideString;
begin
 AnObj := CreateComObject(CLSID_ShellLink);
 ShLink := AnObj as IShellLink;
 PFile := AnObj as IPersistFile;
//Shelllink target
 ShLink.SetPath(PChar( FileName));
//ShowCommand
ShLink.SetShowCmd(SW_SHOWNORMAL);

//Working Dir
WorkingDirectory := ExtractFilePath( ProgramFile );
ShLink.SetWorkingDirectory(PChar( WorkingDirectory ));
// Save
 WFileName := MenuFolder+'\'+ChangeFileExt(extractFileName(LinkFile),'.lnk');
 PFile.Save(PWChar(WFileName), False);
end;
-----------
MenuFolder - must be set to full path to the new created program group folder!!!
0
 
LVL 6

Assisted Solution

by:Amir Azhdari
Amir Azhdari earned 300 total points
ID: 12271105
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 6

Assisted Solution

by:Amir Azhdari
Amir Azhdari earned 300 total points
ID: 12271118
0
 
LVL 11

Accepted Solution

by:
calinutz earned 100 total points
ID: 12274112
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);
0
 
LVL 2

Author Comment

by:SaLz
ID: 12348157
ooops, sorry forgot about the points u all get them.

thxs
Sal.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question