Can anyone tell me how to retreive a shortcut's target? I don't want to read it from the lnk file itself so I thought about com objects... :shock:
Dom
Dom
Hi,
I'm not totally sure but you can do:
- create an IShellLink object
- query that object for IPersistFile
- Call IPersistFile::Load with the path of the .LNK file
- call IShellLink::GetPath to get the path of the target
I'm not totally sure but you can do:
- create an IShellLink object
- query that object for IPersistFile
- Call IPersistFile::Load with the path of the .LNK file
- call IShellLink::GetPath to get the path of the target
well, actually i need the whole target (path + executeable)
IShellLink::GetPath
Retrieves the path and file name of a shell link object.
HRESULT STDMETHODCALLTYPE GetPath(
LPSTR pszFile,
int cchMaxPath,
WIN32_FIND_DATA *pfd,
DWORD fFlags
);
Parameters
pszFile
Address of a buffer that receives the path and file name of the shell link object.
cchMaxPath
Maximum number of bytes to copy to the buffer pointed to by the pszFile parameter.
pfd
Address of a WIN32_FIND_DATA structure that contains information about the shell link object.
fFlags
Flags that specify the type of path information to retrieve. This parameter can be a combination of the following values: Flag Description
SLGP_SHORTPATH Retrieves the standard short (8.3 format) file name.
SLGP_UNCPRIORITY Retrieves the Universal Naming Convention (UNC) path name of the file.
SLGP_RAWPATH Retrieves the raw path name. A raw path is something that might not exist and may include environment variables that need to be expanded.
Return Values
Returns NOERROR if the operation is successful, and a valid path is retrieved. If the operation is successful, but no path is retrieved, it returns S_FALSE and pszPath will be empty. Otherwise, it returns an OLE-defined error value.
See Also
IShellLink
Requirements
Version 4.00 and later of Shell32.dll
Windows NT/2000: Requires Windows NT 4.0 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in shlobj.h.
ok i got it...GetPath is my function. :wink: