christophemonin
asked on
How to execute a shortcut with delphi?
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
Another version:
uses
ShellApi;
var
SomeDirectory: string = 'C:\Program Files';
procedure TForm1.Button1Click(Sender : TObject);
begin
ShellExecute(handle,'explo re',PChar( SomeDirect ory), nil, nil,SW_SHOWNORMAL);
end;
Regards, Geo
Another version:
uses
ShellApi;
var
SomeDirectory: string = 'C:\Program Files';
procedure TForm1.Button1Click(Sender
begin
ShellExecute(handle,'explo
end;
Regards, Geo
nothing to tell more :(
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 .
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(
After that is simple to run it .
In your case the file is 'explorer'
ASKER
Thanks for all, I prefer this one!
But is there a way to execute a shortcut without gettin executing the target?
Christophe.
But is there a way to execute a shortcut without gettin executing the target?
Christophe.
you have to execute command "explorer C:\SomeDirectory".
----
Igor.