Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to execute a shortcut with delphi?

Posted on 2002-04-20
7
Medium Priority
?
1,359 Views
Last Modified: 2008-03-17
Hi!

I created a shortcut which refers to a local directory and I would like to launch it using delphi so it will open a file browser window with the listing of this directory.

How can I do to launch the created shortcut? or is there a way to open a file browser window without using shortcuts?

Thanks in advance!

Christophe
0
Comment
Question by:christophemonin
[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
7 Comments
 
LVL 9

Expert Comment

by:ITugay
ID: 6955817
Hi christophemonin,

you have to execute command "explorer C:\SomeDirectory".


----
Igor.

0
 
LVL 9

Accepted Solution

by:
ITugay earned 400 total points
ID: 6955822
Hi christophemonin,

here is an example:

uses
   ..., ShellApi,.....

const
  SomeDirectory = 'D:\PROJECTS';

procedure TForm1.SpeedButton4Click(Sender: TObject);
var
  S: String;
begin
  S := '/c explorer '+SomeDirectory;
  ShellExecute(handle,'open','command', @S[1], nil,SW_HIDE);
end;

-----
Igor
0
 
LVL 17

Expert Comment

by:geobul
ID: 6955899
Hi,
Another version:

uses
  ShellApi;

var
 SomeDirectory: string = 'C:\Program Files';

procedure TForm1.Button1Click(Sender: TObject);
begin
   ShellExecute(handle,'explore',PChar(SomeDirectory), nil, nil,SW_SHOWNORMAL);
end;

Regards, Geo
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 9

Expert Comment

by:ginsonic
ID: 6955976
nothing to tell more :(
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6955985
Or...

If you wish to get the target of your shortcut then read next article :

'Get Shortcut Target File'
http://www.delphi3000.com/article.asp?ID=1838

Using this info :

var Target:string;
....
Target:=GetShortcutTarget('c:\MyLink.pif');

After that is simple to run it .
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6955989
In your case the file is 'explorer'
0
 

Author Comment

by:christophemonin
ID: 6956187
Thanks for all, I prefer this one!

But is there a way to execute a shortcut without gettin executing the target?

Christophe.
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

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…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

604 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