Solved

Create a Shortcut

Posted on 2004-10-10
6
444 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
Independent Software Vendors: 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…

740 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