IShellLinkW::Resolve method (shobjidl_core.h)
Attempts to find the target of a Shell link, even if it has been moved or renamed.
HRESULT Resolve( HWND hwnd, DWORD fFlags );
A handle to the window that the Shell will use as the parent for a dialog box. The Shell displays the dialog box if it needs to prompt the user for more information while resolving a Shell link.
Action flags. This parameter can be a combination of the following values.
0x0001. Do not display a dialog box if the link cannot be resolved. When SLR_NO_UI is set, the high-order word of fFlags can be set to a time-out value that specifies the maximum amount of time to be spent resolving the link. The function returns if the link cannot be resolved within the time-out duration. If the high-order word is set to zero, the time-out duration will be set to the default value of 3,000 milliseconds (3 seconds). To specify a value, set the high word of fFlags to the desired time-out duration, in milliseconds.
0x0002. Not used.
0x0004. If the link object has changed, update its path and list of identifiers. If SLR_UPDATE is set, you do not need to call IPersistFile::IsDirty to determine whether the link object has changed.
0x0008. Do not update the link information.
0x0010. Do not execute the search heuristics.
0x0020. Do not use distributed link tracking.
0x0040. Disable distributed link tracking. By default, distributed link tracking tracks removable media across multiple devices based on the volume name. It also uses the UNC path to track remote file systems whose drive letter has changed. Setting SLR_NOLINKINFO disables both types of tracking.
0x0080. Call the Windows Installer.
0x0101. Windows XP and later.
0x0200. Windows 7 and later. Offer the option to delete the shortcut when this method is unable to resolve it, even if the shortcut is not a shortcut to a file.
0x0400. Windows 7 and later. Report as dirty if the target is a known folder and the known folder was redirected. This only works if the original target path was a file system path or ID list and not an aliased known folder ID list.
0x0800. Windows 7 and later. Resolve the computer name in UNC targets that point to a local computer. This value is used with SLDF_KEEP_LOCAL_IDLIST_FOR_UNC_TARGET.
0x1000. Windows 7 and later. Update the computer GUID and user SID if necessary.
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Following link creation, the name or location of the target may change. The IShellLink::Resolve method first retrieves the path associated with the link. If the object is no longer there or has been renamed, Resolve will attempt to find it. If successful, and the following conditions are met, the file that the link object was loaded from will be updated to reflect the new state of the link object.
- The SLR_UPDATE flag is set.
- The target has been moved or renamed, updating the internal state of the Shell link object to refer to the new target.
- The Shell link object was loaded from a file through IPersistFile.
Resolve has two approaches to finding target objects. The first is the distributed link tracking service. If the service is available, it can find an object that was on an NTFS version 5.0 volume and was moved to another location on that volume. It can also find an object that was moved to another NTFS version 5.0 volume, including volumes on other computers. To suppress the use of this service, set the SLR_NOTRACK flag.
If distributed link tracking is not available or fails to find the link object, Resolve attempts to find it with search heuristics. It first looks in the object's last known directory for an object with a different name but the same attributes and file creation time. Next, it recursively searches subdirectories in the vicinity of the object's last known directory. It looks for an object with the same name or creation time. Finally, Resolve looks for a matching object on the desktop and other local volumes. To suppress the use of the search heuristics, set the SLR_NOSEARCH flag.
If both approaches fail, the system will display a dialog box prompting the user for a location. To suppress the dialog box, set the SLR_NO_UI flag.
|Minimum supported client||Windows XP [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|DLL||Shell32.dll (version 4.0 or later)|