Basic Univers
; Auteur : ?
; Désignation : renvoie le liens vers lequel pointe le raccourcis.
; En le modifiant tu pourrais retrouver tous les éléments du
;   raccourcis / en regénérer un nouveau avec tes paramètres ( nouvel icone ou autre )


Procedure.s ShortcutTarget(ShortcutFile$)
  Result$ = ""
 
  CoInitialize_(0)
  If CoCreateInstance_(?CLSID_ShellLink, 0, 1, ?IID_IShellLink, @ShellLink.IShellLinkA) = #S_OK
   
    If ShellLink\QueryInterface(?IID_IPersistFile, @LinkFile.IPersistFile) = #S_OK
     
      *buffer = AllocateMemory(1000)
      If *buffer
       
        MultiByteToWideChar_(#CP_ACP, 0, @ShortcutFile$, - 1, *buffer, 1000)
       
        If LinkFile\Load(*buffer, 0) = #S_OK
         
          If ShellLink\Resolve(0, 1) = #S_OK
           
            RtlZeroMemory_(*buffer, 1000)
            ShellLink\GetPath(*buffer, 1000, 0, 0)
            Result$ = PeekS(*buffer)
           
          EndIf
         
        EndIf
       
        FreeMemory(*buffer)
      EndIf
     
      LinkFile\Release()
    EndIf
   
    ShellLink\Release()
  EndIf
 
  CoUninitialize_()
 
  ProcedureReturn Result$
 
  DataSection
  CLSID_ShellLink:
  ; 00021401-0000-0000-C000-000000000046
  Data.l $00021401
  Data.w $0000, $0000
  Data.b $C0, $00, $00, $00, $00, $00, $00, $46
 
  IID_IShellLink:
  ; DEFINE_SHLGUID(IID_IShellLinkA,         0x000214EEL, 0, 0);
  ; C000-000000000046
  Data.l $000214EE
  Data.w $0000, $0000
  Data.b $C0, $00, $00, $00, $00, $00, $00, $46
 
  IID_IPersistFile:
  ; 0000010b-0000-0000-C000-000000000046
  Data.l $0000010B
  Data.w $0000, $0000
  Data.b $C0, $00, $00, $00, $00, $00, $00, $46
  EndDataSection
EndProcedure