You can check if any of the icons have the target you are searching for. The following function may be useful.
uses
Winapi.ShellAPI,
Winapi.ShlObj,
System.Win.ComObj,
System.Win.Registry,
Winapi.ActiveX
function ArquivoPeloLink(const NomeLink: String): String;
var
AObject: IUnknown;
ASLink: IShellLink;
APFile: IPersistFile;
WNomeLink: WideString;
PFD: TWin32FindData;
begin
AObject := CreateComObject(CLSID_ShellLink);
ASLink := AObject as IShellLink;
APFile := AObject as IPersistFile;
WNomeLink := NomeLink;
APFile.Load(PWideChar(WNomeLink), 0);
SetLength(Result, MAX_PATH);
ASLink.GetPath(PChar(Result), MAX_PATH, PFD, 0);
end;
I took it from here. Use:
LinkArquivo := ArquivoPeloLink('C:\Users\Public\Desktop\Atalho.lnk')
Thank you for helping, I will give an analysis in your reply, if I succeed mark her.
– Jefferson Rudolf
You can also use the Windows environment variable
%HOMEPATH%
pointing to the directory defined for the current user. Just use the cited function in conjunction withGetEnvironmentVariable
if you do not want to create a public shortcut.– Marcos Regis