PDA

Ver la Versión Completa : ERROR:ShLink.GetPath(Buffer, Sizeof(Buffer), Data, SLGP_UNCPRIORITY)


Mav
25-05-2008, 23:15:19
function estrai_path_da_lnk(filen:widestring):widestring;
var
AnObj: IUnknown;
ShLink: IShellLinkW;
PFile: IPersistFile;
Data: TWin32FindData;
Buffer: array [0..255] of widechar;
begin
result:='';
try
AnObj := CreateComObject(CLSID_ShellLink);
ShLink := AnObj as IShellLinkW;
PFile := AnObj as IPersistFile;

PFile.Load(PWChar(FileN), STGM_READ);


ShLink.GetPath(Buffer, Sizeof(Buffer), Data, SLGP_UNCPRIORITY);
result := Buffer;

except
end;
end;

En esta linea es donde dá el siguiente error:
ShLink.GetPath(Buffer, Sizeof(Buffer), Data, SLGP_UNCPRIORITY);

[DCC Error] helper_urls.pas(153): E2033 Types of actual and formal var parameters must be identical

En ShlObj.pas:

IShellLinkW = interface(IUnknown) { sl }
[SID_IShellLinkW]
function GetPath(pszFile: PWideChar; cchMaxPath: Integer;
var pfd: TWin32FindDataW; fFlags: DWORD): HResult; stdcall;


De la "Guia de Referencia de Delphi":

(E2033)Types of actual and formal var parameters must be identical:
For a variable parameter, the actual argument must be of the exact type of the formal parameter.
He cambiado declaraciones de variables, modificado parámetros ,en fin le he dado a esto muchas vueltas...No le encuentro la solución.
¿Podria alguien ayudarme? ¡ Gracias!
Saludos a todos.

xEsk
25-05-2008, 23:55:25
Hola, prueba cambiando
Data: TWin32FindData;porData: TWin32FindDataW;

El error ya te esta dando una pista de cual es el problema, que los tipos deben ser identicos, y si te fijas el tipo del parametro pfd es TWin32FindDataW y no TWin32FindData.

function GetPath(pszFile: PWideChar; cchMaxPath: Integer; var pfd: TWin32FindDataW; fFlags: DWORD): HResult; stdcall;

Saludos.

Mav
26-05-2008, 21:31:49
Si,si! ¡Correcto, muchas gracias!
Como no lo ví, si lo tenía delante...
Saludos:)