Sample code for 30+ languages & platforms
Delphi ActiveX

Get the Target of a Windows Shortcut

See more FileAccess Examples

Demonstrates how to get the target of a Windows shortcut.

Note: This example requires Chilkat v9.5.0.77 or greater.

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;

...

procedure TForm1.Button1Click(Sender: TObject);
var
fac: TCkFileAccess;
targetPath: WideString;

begin
fac := TCkFileAccess.Create(Self);

targetPath := fac.SymlinkTarget('qa_data/my_shortcut');
if (fac.LastMethodSuccess <> 1) then
  begin
    Memo1.Lines.Add('Failed to get shortcut target.');
    Exit;
  end;
Memo1.Lines.Add('target path = ' + targetPath);
end;