Ver Mensaje Individual
  #3  
Antiguo 22-03-2008
octalh octalh is offline
Miembro
 
Registrado: feb 2008
Posts: 18
Reputación: 0
octalh Va por buen camino
hola muchas gracias por responder, aqui esta el codigo que hice
Código:
program Project2;

{$APPTYPE CONSOLE}

uses
  ShlObj,
  Windows,
  ActiveX,
  SysUtils;


function GetTarget(const LinkFileName:String):String;
var
   //Link : String;
   psl  : IShellLink;
   ppf  : IPersistFile;
   WidePath  : Array[0..260] of WideChar;
   Info      : Array[0..MAX_PATH] of Char;
   wfs       : TWin32FindData;
begin
  if UpperCase(ExtractFileExt(LinkFileName)) <> '.LNK' Then
  begin
    Result:='NOT a shortuct by extension!';
    Exit;
  end;

  CoCreateInstance(CLSID_ShellLink, nil, CLSCTX_INPROC_SERVER, IShellLink, psl);
  if psl.QueryInterface(IPersistFile, ppf) = 0 Then
  Begin
    MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, PChar(LinkFileName), -1, @WidePath, MAX_PATH);
    ppf.Load(WidePath, STGM_READ);
    psl.GetPath(@info, MAX_PATH, wfs, SLGP_UNCPRIORITY);
    Result := info;
  end
  else
    Result := '';
end;

procedure leerdirectorio;
const
 tmp = 'c:\prueba.lnk';
var
target : string;

  begin
     target := GetTarget(tmp);
     writeln(target);
     readln;
  end;


begin
leerdirectorio;
end.
Este es el error que me da

Exception EAccessViolation in module Project2.exe at 00008569.
Access violation at address 00408569 in module 'Project2.exe'. Read of address 00000000.

gracias
Responder Con Cita