IShellLinkW::GetPath method (shobjidl_core.h)

Gets the path and file name of the target of a Shell link object.

Syntax

HRESULT GetPath(
  [out]     LPWSTR           pszFile,
  [in]      int              cch,
  [in, out] WIN32_FIND_DATAW *pfd,
  [in]      DWORD            fFlags
);

Parameters

[out] pszFile

Type: LPTSTR

The address of a buffer that receives the path and file name of the target of the Shell link object.

[in] cch

Type: int

The size, in characters, of the buffer pointed to by the pszFile parameter, including the terminating null character. The maximum path size that can be returned is MAX_PATH. This parameter is commonly set by calling ARRAYSIZE(pszFile). The ARRAYSIZE macro is defined in Winnt.h.

[in, out] pfd

Type: WIN32_FIND_DATA*

A pointer to a WIN32_FIND_DATA structure that receives information about the target of the Shell link object. If this parameter is NULL, then no additional information is returned.

[in] fFlags

Type: DWORD

Flags that specify the type of path information to retrieve. This parameter can be a combination of the following values.

SLGP_SHORTPATH

Retrieves the standard short (8.3 format) file name.

SLGP_UNCPRIORITY

Unsupported; do not use.

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.

SLGP_RELATIVEPRIORITY

Windows Vista and later. Retrieves the path, if possible, of the shortcut's target relative to the path set by a previous call to IShellLink::SetRelativePath.

Return value

Type: HRESULT

Returns S_OK 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 pszFile will be empty. Otherwise, it returns one of the standard HRESULT error values.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shobjidl_core.h
DLL Shell32.dll (version 4.0 or later)