Solved

Create a Shortcut

Posted on 2004-10-10
6
453 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

705 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