function ReadLink(AFileName: String):String;<br>var<br> psl: IShellLink;<br> ppf: IPersistFile;<br> WCLinkName: array[0..Max_Path] of WideChar;<br> Buf: array[0..255] of Char;<br> Data: TWin32FindData;<br>begin<br> psl:=CreateComObject(CLSID_ShellLink) as IShellLink; <br> ppf:=psl as IPersistFile;<br><br> StringToWideChar(AFileName, WCLinkName, MAX_PATH);<br> ppf.Load(WCLinkName, STGM_READ);<br><br> psl.GetPath(@Buf, Max_Path, Data, SLGP_UNCPRIORITY);<br> Result := StrPas(Buf);<br>end;<br><br>用法:filename:=ReadLink('aaaa.lnk'); 可以得到.lnk指向的文件名。<br><br>删除文件与该文件lnk的无关。