Skip to content

Latest commit

 

History

History
169 lines (98 loc) · 7.6 KB

nf-shellapi-shgetnewlinkinfow.md

File metadata and controls

169 lines (98 loc) · 7.6 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:shellapi.SHGetNewLinkInfoW
SHGetNewLinkInfoW function (shellapi.h)
Creates a name for a new shortcut based on the shortcut's proposed target. This function does not create the shortcut, just the name. (Unicode)
SHGNLI_NOLNK
SHGNLI_NOLOCNAME
SHGNLI_NOUNIQUE
SHGNLI_PIDL
SHGNLI_PREFIXNAME
SHGNLI_USEURLEXT
SHGetNewLinkInfo
SHGetNewLinkInfo function [Windows Shell]
SHGetNewLinkInfoW
_win32_SHGetNewLinkInfo
shell.SHGetNewLinkInfo
shellapi/SHGetNewLinkInfo
shellapi/SHGetNewLinkInfoW
shell\SHGetNewLinkInfo.htm
shell
ca658d5c-af7b-400c-8f4d-7d4b07bf7f2b
12/05/2018
SHGNLI_NOLNK, SHGNLI_NOLOCNAME, SHGNLI_NOUNIQUE, SHGNLI_PIDL, SHGNLI_PREFIXNAME, SHGNLI_USEURLEXT, SHGetNewLinkInfo, SHGetNewLinkInfo function [Windows Shell], SHGetNewLinkInfoA, SHGetNewLinkInfoW, _win32_SHGetNewLinkInfo, shell.SHGetNewLinkInfo, shellapi/SHGetNewLinkInfo, shellapi/SHGetNewLinkInfoA, shellapi/SHGetNewLinkInfoW
shellapi.h
Windows
Windows 2000 Professional, Windows XP, Windows 7 [desktop apps only]
Windows 2000 Server [desktop apps only]
SHGetNewLinkInfoW (Unicode) and SHGetNewLinkInfoA (ANSI)
Shell32.lib
Shell32.dll (version 4.71 or later)
Windows
19H1
SHGetNewLinkInfoW
shellapi/SHGetNewLinkInfoW
c++
APIRef
kbSyntax
DllExport
Shell32.dll
SHGetNewLinkInfo
SHGetNewLinkInfoA
SHGetNewLinkInfoW

SHGetNewLinkInfoW function

-description

Creates a name for a new shortcut based on the shortcut's proposed target. This function does not create the shortcut, just the name.

-parameters

-param pszLinkTo [in]

Type: LPCTSTR

A pointer to the path and file name of the shortcut's target. If uFlags does not contain the SHGNLI_PIDL value, this parameter is the address of a null-terminated string that contains the target. If uFlags contains the SHGNLI_PIDL value, this parameter is a PIDL that represents the target.

-param pszDir [in]

Type: LPCTSTR

A pointer to a null-terminated string that contains the path of the folder in which the shortcut would be created.

-param pszName [out]

Type: LPTSTR

A pointer to a string that receives the null-terminated path and file name for the shortcut. This buffer is assumed to be at least MAX_PATH characters in size.

-param pfMustCopy [out]

Type: BOOL*

The address of a BOOL value that receives a flag indicating whether the shortcut would be copied. When a shortcut to another shortcut is created, the Shell simply copies the target shortcut and modifies that copied shortcut appropriately. This parameter receives a nonzero value if the target specified in pszLinkTo specifies a shortcut that will cause the target shortcut to be copied. This parameter receives zero if the target does not specify a shortcut that would be copied.

-param uFlags [in]

Type: UINT

The options for the function. This can be zero or a combination of the following values.

SHGNLI_PIDL (0x000000001)

0x000000001. The target pointed to by pszLinkTo is a PIDL that represents the target. If this flag is not included, pszLinkTo is regarded as the address of a string that contains the path and file name of the target.

SHGNLI_NOUNIQUE (0x000000002)

0x000000002. Skip the normal checks that ensure that the shortcut name is unique within the destination folder. If this flag is not included, the function creates the shortcut name and then determines whether the name is unique in the destination folder. If a file with the same name already exists in the destination folder, the shortcut name will be modified. This process is repeated until a unique name is found.

SHGNLI_PREFIXNAME (0x000000004)

0x000000004. The created name will be preceded by the string "Shortcut to ".

SHGNLI_NOLNK (0x000000008)

0x000000008. Version 5.0 Do not add the .lnk file name extension. You must set the _WIN32_IE macro to 5.01 or greater to use this flag. For more information about versioning, see Shell and Common Controls Versions.

SHGNLI_NOLOCNAME (0x000000010)

0x000000010. Windows Vista and later. Use the non-localized parsing name of the target pointed to by pszLinkTo as the name of the shortcut file. If this flag is not set, the localized name is used.

SHGNLI_USEURLEXT (0x000000020)

0x000000020. Windows 7 and later. Append a .url file name extension (rather than .lnk) to the name pointed to by pszName. If this flag is not set, the shortcut name uses a .lnk extension unless SHGNLI_NOLNK is set.

- uFlags.SHGNLI_NOLNK (0x000000008)

0x000000008. Version 5.0 Do not add the .lnk file name extension. You must set the _WIN32_IE macro to 5.01 or greater to use this flag. For more information about versioning, see Shell and Common Controls Versions.

- uFlags.SHGNLI_NOLOCNAME (0x000000010)

0x000000010. Windows Vista and later. Use the non-localized parsing name of the target pointed to by pszLinkTo as the name of the shortcut file. If this flag is not set, the localized name is used.

- uFlags.SHGNLI_NOUNIQUE (0x000000002)

0x000000002. Skip the normal checks that ensure that the shortcut name is unique within the destination folder. If this flag is not included, the function creates the shortcut name and then determines whether the name is unique in the destination folder. If a file with the same name already exists in the destination folder, the shortcut name will be modified. This process is repeated until a unique name is found.

- uFlags.SHGNLI_PIDL (0x000000001)

0x000000001. The target pointed to by pszLinkTo is a PIDL that represents the target. If this flag is not included, pszLinkTo is regarded as the address of a string that contains the path and file name of the target.

- uFlags.SHGNLI_PREFIXNAME (0x000000004)

0x000000004. The created name will be preceded by the string "Shortcut to ".

- uFlags.SHGNLI_USEURLEXT (0x000000020)

0x000000020. Windows 7 and later. Append a .url file name extension (rather than .lnk) to the name pointed to by pszName. If this flag is not set, the shortcut name uses a .lnk extension unless SHGNLI_NOLNK is set.

-returns

Type: BOOL

Returns TRUE if successful; otherwise, FALSE.

-remarks

SHGetNewLinkInfo determines whether the destination file system supports long file names. If it does, a long file name is used for the shortcut name. If the destination file system does not support long file names, the shortcut name is returned in an 8.3 format.

Note

The shellapi.h header defines SHGetNewLinkInfo as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.