使用界面的IShellLink解决这已改变了他们的驱动器盘符的快捷方式 [英] Using IShellLink Interface to resolve a shortcut which has changed their drive letter

查看:150
本文介绍了使用界面的IShellLink解决这已改变了他们的驱动器盘符的快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据MSDN信息在这里:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb774952%28v=vs.85%29.aspx

在这里:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb774944%28v=vs.85%29.aspx

如何解决谁改变了驱动器号上的快捷方式链接的完整路径目标?

窗户在不到一秒钟会自动完成,但我需要有很多在我的申请,我总是得到原始的老路快捷方式文件(.LNK文件)工作,我解决不了像Windows路径确实。

因此​​,举例来说,如果我在这个路径中的快捷方式文件:

  C:\\ Test.lnk

和快捷方式文件的目标就是这个。

  D:\\目录\\ Test.txt的

然后,如果我重新命名从硬盘驱动器的驱动器字母D到F:(该硬盘,而不是目标的快捷方式),Windows仍然能够识别快捷方式是有效的,并可以立即解决的快捷方式路径,所以我知道这可能是可能与IShellInterface做到这一点,但问题是我不知道该怎么做。

我不明白我需要做什么来解决该快捷方式,我不知道我是否需要使用的getPath方法或解决方法,或两者​​兼而有之,也不知我需要通过该窗口句柄以决心方法......然后是推出了MSGBOX在窗口或方法将返回一个字符串与reoslved路径?所有这一切都是让我疯了,我需要一个code的例子。

我使用这个类:

 导入System.Runtime.InteropServices
进口System.Text公共类Form1的私人小组Form1_Load的(发件人为System.Object的,电子作为System.EventArgs)把手MyBase.Load
    昏暗TargetFilename作为字符串= ResolveShortcut(C:\\ Test.lnk)
结束小组<的DllImport(Shfolder.dll中,字符集:= CharSet.Auto)GT;
朋友共享功能的SHGetFolderPath(hwndOwner作为IntPtr的,n文件夹作为整数,hToken作为IntPtr的,dwFlags中作为整数,lpszPath作为StringBuilder的)作为整数
结束功能<旗()>
私人枚举SLGP_FLAGS
    '''<总结>检索标准短(8.3格式)文件名和LT; /总结>
    SLGP_SHORTPATH​​ =安培; H1
    '''<总结>检索通用命名约定(UNC)路径的文件&LT的名称; /总结>
    SLGP_UNCPRIORITY =安培; H2
    '''<总结>获取原始路径名。的裸路径是一些可能不存在,并且可以包括需要扩大与所述环境变量; /总结>
    SLGP_RAWPATH =安培; H4
结束枚举< StructLayout(LayoutKind.Sequential,字符集:= CharSet.Auto)GT;
PRIVATE STRUCTURE WIN32_FIND_DATAW
    公共dwFileAttributes作为UInteger
    公共ftCreationTime只要
    公共ftLastAccessTime只要
    公共ftLastWriteTime只要
    公共nFileSizeHigh作为UInteger
    公共nFileSizeLow作为UInteger
    公共dwReserved0作为UInteger
    公共dwReserved1作为UInteger
    <的MarshalAs(UnmanagedType.ByValTStr,SizeConst:= 260)>
    公共cFileName作为字符串
    <的MarshalAs(UnmanagedType.ByValTStr,SizeConst:= 14)>
    公共cAlternateFileName作为字符串
末端结构<旗()>
私人枚举SLR_FLAGS
    '''<总结>
    '''不要显示一个对话框,如果链接不能得到解决。当SLR_NO_UI被设置,
    '''FFLAGS的高位字可以被设置为指定一个超时值
    '''的时间最大量的花费解决的链接。该函数返回如果
    '''连接不能在超时持续时间内解决。如果高位字被设定
    '''为零,超时持续时间将被设置为3000毫秒的默认值
    '''(3秒)。要指定值,FFLAGS的高位字设置为所需的超时
    '''持续的时间,单位为毫秒。
    '''< /总结>
    SLR_NO_UI =安培; H1
    '''<总结>已过时,不再使用< /总结>
    SLR_ANY_MATCH =安培; H2
    '''&所述;总结>如果链接对象已经改变,更新其路径和标识符的列表。
    '''如果SLR_UPDATE设置,你并不需要调用IPersistFile :: IsDirty确定
    '''的链接对象是否已经改变与所述; /总结>
    SLR_UPDATE =安培; H4
    '''<总结>不要更新链接信息< /总结>
    SLR_NOUPD​​ATE =安培; H8
    '''<总结>不执行搜索启发式< /总结>
    SLR_NOSEARCH =安培; H10
    '''<总结>不要使用分布式链接跟​​踪< /总结>
    SLR_NOTRACK =安培; H20
    '''<总结>禁止分布式链接跟​​踪。默认情况下,分布式链接跟​​踪轨道
    '''上根据用户的卷名的多个设备的可移动介质。它还使用
    '''通用命名约定(UNC)路径追踪远程文件系统的驱动器盘符
    ''' 已经改变。设置SLR_NOLINKINFO禁用这两种类型的跟踪< /总结>
    SLR_NOLINKINFO =安培; H40
    '''<总结>调用Microsoft Windows安装< /总结>
    SLR_INVOKE_MSI =安培; H80
结束枚举'''&所述;总结>将的IShellLink界面允许创建壳牌链路,修改和解决与下/总结>
< ComImport(),InterfaceType(ComInterfaceType.InterfaceIsIUnknown)的Guid(000214F9-0000-0000-C000-000000000046)>
专用接口IShellLinkW
    '''<总结>检索壳牌链接对象&LT的路径和文件名; /总结>
    子的getPath(小于输出()的MarshalAs(UnmanagedType.LPWStr)GT; pszFile作为StringBuilder的,cchMaxPath整数,为ByRef PFD作为WIN32_FIND_DATAW,FFLAGS作为SLGP_FLAGS)
    '''<总结>检索项标识符外壳链接对象&LT名单; /总结>
    子GetIDList(为ByRef ppidl作为IntPtr的)
    '''<总结>设置指针的项目标识符列表(PIDL)的外壳链接对象< /总结>
    子SetIDList(PIDL作为IntPtr的)
    '''<总结>检索外壳链接对象&LT描述字符串; /总结>
    子GetDescription(小于输出()的MarshalAs(UnmanagedType.LPWStr)GT; pszName作为StringBuilder的,cchMaxName作为整数)
    '''<总结>设置外壳链接对象的描述。说明可以是任何应用程序定义的字符串和LT; /总结>
    子SetDescription(小于的MarshalAs(UnmanagedType.LPWStr)GT; pszName作为字符串)
    '''<总结>检索外壳链接对象&LT工作目录的名称; /总结>
    子GetWorkingDirectory(小于输出()的MarshalAs(UnmanagedType.LPWStr)GT; pszDir作为StringBuilder的,cchMaxPath作为整数)
    '''<总结>设置外壳链接对象&LT工作目录的名称; /总结>
    子SetWorkingDirectory(小于的MarshalAs(UnmanagedType.LPWStr)GT; pszDir作为字符串)
    '''<总结>检索与壳牌链接对象和相关联的命令行参数; /总结>
    子GetArguments(小于输出()的MarshalAs(UnmanagedType.LPWStr)GT; pszArgs作为StringBuilder的,cchMaxPath作为整数)
    '''<总结>设置外壳链接对象&LT命令行参数; /总结>
    子SetArguments(小于的MarshalAs(UnmanagedType.LPWStr)GT; pszArgs作为字符串)
    '''<总结>检索外壳链接对象&LT热键; /总结>
    子GetHotkey(为ByRef pwHotkey短)
    '''<总结>设置外壳链接对象℃的热键; /总结>
    子SetHotkey(wHotkey短)
    '''<总结>检索外壳链接对象&LT show命令; /总结>
    子GetShowCmd(为ByRef piShowCmd作为整数)
    '''<总结>设置外壳链接对象的show命令。 show命令设​​置窗口初步显现态LT; /总结>
    子SetShowCmd(iShowCmd作为整数)
    '''<总结>检索外壳链接对象&LT图标的位置(路径和索引); /总结>
    子GetIconLocation(小于输出()的MarshalAs(UnmanagedType.LPWStr)GT; pszIconPath作为StringBuilder的,cchIconPath整数,为ByRef piIcon作为整数)
    '''<总结>设置外壳链接对象&LT图标的位置(路径和索引); /总结>
    子SetIconLocation(小于的MarshalAs(UnmanagedType.LPWStr)GT; pszIconPath作为字符串,iIcon作为整数)
    '''<总结>设置在外壳链接对象&LT的相对路径; /总结>
    子SetRelativePath(小于的MarshalAs(UnmanagedType.LPWStr)GT; pszPathRel作为字符串,dwReserved作为整数)
    '''<总结>试图找到一个Shell链接的目标,即使它已被移动或重命名< /总结>
    子解析(HWND作为IntPtr的,FFLAGS作为SLR_FLAGS)
    '''<总结>设置外壳链接对象&LT的路径和文件名; /总结>
    子的setpath(小于的MarshalAs(UnmanagedType.LPWStr)GT; pszFile作为字符串)结束接口< ComImport()的Guid(0000010c-0000-0000-C000-000000000046),InterfaceType(ComInterfaceType.InterfaceIsIUnknown)GT;
公共接口的IPersist
    < preserveSig()>
    子的GetClassID(为ByRef pClassID作为GUID)
结束接口
< ComImport()的Guid(0000010b-0000-0000-C000-000000000046),InterfaceType(ComInterfaceType.InterfaceIsIUnknown)GT;
公共接口IPersistFile
    继承的IPersist
    阴影子的GetClassID(为ByRef pClassID作为GUID)
    < preserveSig()>
    功能IsDirty()作为整数    < preserveSig()>
    子负载(小于[IN]()的MarshalAs(UnmanagedType.LPWStr)GT; pszFileName作为字符串,dwMode作为UInteger)    < preserveSig()>
    Sub保存(小于[IN]()的MarshalAs(UnmanagedType.LPWStr)GT; pszFileName作为字符串,< [IN]()的MarshalAs(UnmanagedType.Bool)GT; fRemember由于布尔)    < preserveSig()>
    子SaveCompleted(小于[IN]()的MarshalAs(UnmanagedType.LPWStr)GT; pszFileName作为字符串)    < preserveSig()>
    子GetCurFile(小于[IN]()的MarshalAs(UnmanagedType.LPWStr)GT; ppszFileName作为字符串)
结束接口常量STGM_READ作为UInteger = 0
常量MAX_PATH作为整数= 260从CLSID_ShellLink ShlGuid.h
< ComImport()的Guid(00021401-0000-0000-C000-000000000046)>公共类ShellLink
末级
公共共享功能ResolveShortcut(文件名作为字符串)作为字符串
    昏暗的链接作为新ShellLink()
    DirectCast(链接,IPersistFile).Load(文件名,STGM_READ)
    'TODO:如果我能先得到HWND呼叫决心保持。该手柄移动和重命名的文件。
    ((IShellLinkW)链接).Resolve(HWND,0)
    昏暗某人作为新的StringBuilder(MAX_PATH)
    昏暗的数据作为新WIN32_FIND_DATAW()
    DirectCast(链接,IShellLinkW).GetPath(SB,sb.Capacity,数据,0)
    返回sb.ToString()
结束功能末级


  

编辑:


如果你知道一个简单而有效的方式来获得完整路径时,驱动器号的变化只是那么我会接受的答案。

但我不希望是用旧VB6方法或VBS或使用外部应用程序或For循环,这就是为什么我试图使用API​​的,我认为是性能最好的方法。


解决方案

这仅与所连接的网络驱动器测试(我不会像改变我的地方driveletters用于测试):

 公共共享功能ResolveShortcut(文件名作为字符串,HWND作为IntPtr的)作为字符串
    昏暗的链接作为新ShellLink()
    DirectCast(链接,IPersistFile).Load(文件名,STGM_READ)    DirectCast(链接,IShellLinkW).Resolve(HWND,SLR_FLAGS.SLR_UPDATE)    昏暗某人作为新的StringBuilder(MAX_PATH)
    昏暗的数据作为新WIN32_FIND_DATAW()
    DirectCast(链接,IShellLinkW).GetPath(SB,sb.Capacity,数据,0)
    返回sb.ToString()
结束功能

要叫这样的:

 私人小组Form1_Load的(发件人为System.Object的,电子作为System.EventArgs)把手MyBase.Load
    昏暗TargetFilename作为字符串= ResolveShortcut(C:\\ Test.lnk,Me.Handle)
结束小组

如文档,你已经下文称来,说:


  

SLR_UPDATE(0x0004单元)结果
      如果链接对象已经改变,更新其路径和标识符的列表。如果SLR_UPDATE设置,你并不需要调用IPersistFile :: IsDirty确定链接对象是否已经改变。


所以传递表单的句柄调用Resolve方法,并在正确的道路通过SLR_UPDATE作为第二个参数,结果连networkdrive(至少在(其中如果需要显示一些对话框壳牌将需要)我站点)。

According to MSDN Information here:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb774952%28v=vs.85%29.aspx

And here:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb774944%28v=vs.85%29.aspx

How I can resolve the fullpath of a link who has changed the driveletter on the shortcut Target?

Windows does this automatically in less than one second, but I need to work with a lot of shortcut files (.lnk files) in my application and I always get the raw old path, I can't resolve the path like windows does.

So for example if I have a shortcut file in this path:

C:\Test.lnk

And the target of the shortcut file is this

D:\Directory\Test.txt

Then If I rename the drive letter of the hard drive from "D:" to "F:" (the harddrive, not the target shortcut) Windows can still recognizing the shortcut as valid and can resolve the shortcut path instantly, so I know this can be possibly to do it with the IShellInterface but the problem is I don't know how to do it.

I don't understand what I need to do to resolve the shortcut, I don't know if I need to use GetPath method or Resolve Method, or both, also I don't know which window handle I need to pass to the resolve method...then is for launch a msgbox in a window or the method will return a string with the reoslved path?, all of this is getting me crazy, I need a code example.

I'm using this Class:

Imports System.Runtime.InteropServices
Imports System.Text

Public Class Form1

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    Dim TargetFilename As String = ResolveShortcut("C:\Test.lnk")
End Sub

<DllImport("shfolder.dll", CharSet:=CharSet.Auto)>
Friend Shared Function SHGetFolderPath(hwndOwner As IntPtr, nFolder As Integer, hToken As IntPtr, dwFlags As Integer, lpszPath As StringBuilder) As Integer
End Function

<Flags()>
Private Enum SLGP_FLAGS
    ''' <summary>Retrieves the standard short (8.3 format) file name</summary>
    SLGP_SHORTPATH = &H1
    ''' <summary>Retrieves the Universal Naming Convention (UNC) path name of the file</summary>
    SLGP_UNCPRIORITY = &H2
    ''' <summary>Retrieves the raw path name. A raw path is something that might not exist and may include environment variables that need to be expanded</summary>
    SLGP_RAWPATH = &H4
End Enum

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)>
Private Structure WIN32_FIND_DATAW
    Public dwFileAttributes As UInteger
    Public ftCreationTime As Long
    Public ftLastAccessTime As Long
    Public ftLastWriteTime As Long
    Public nFileSizeHigh As UInteger
    Public nFileSizeLow As UInteger
    Public dwReserved0 As UInteger
    Public dwReserved1 As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)>
    Public cFileName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=14)>
    Public cAlternateFileName As String
End Structure

<Flags()>
Private Enum SLR_FLAGS
    ''' <summary>
    ''' 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.
    ''' </summary>
    SLR_NO_UI = &H1
    ''' <summary>Obsolete and no longer used</summary>
    SLR_ANY_MATCH = &H2
    ''' <summary>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 or not the link object has changed.</summary>
    SLR_UPDATE = &H4
    ''' <summary>Do not update the link information</summary>
    SLR_NOUPDATE = &H8
    ''' <summary>Do not execute the search heuristics</summary>
    SLR_NOSEARCH = &H10
    ''' <summary>Do not use distributed link tracking</summary>
    SLR_NOTRACK = &H20
    ''' <summary>Disable distributed link tracking. By default, distributed link tracking tracks
    ''' removable media across multiple devices based on the volume name. It also uses the
    ''' Universal Naming Convention (UNC) path to track remote file systems whose drive letter
    ''' has changed. Setting SLR_NOLINKINFO disables both types of tracking.</summary>
    SLR_NOLINKINFO = &H40
    ''' <summary>Call the Microsoft Windows Installer</summary>
    SLR_INVOKE_MSI = &H80
End Enum

''' <summary>The IShellLink interface allows Shell links to be created, modified, and resolved</summary>
<ComImport(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("000214F9-0000-0000-C000-000000000046")>
Private Interface IShellLinkW
    ''' <summary>Retrieves the path and file name of a Shell link object</summary>
    Sub GetPath(<Out(), MarshalAs(UnmanagedType.LPWStr)> pszFile As StringBuilder, cchMaxPath As Integer, ByRef pfd As WIN32_FIND_DATAW, fFlags As SLGP_FLAGS)
    ''' <summary>Retrieves the list of item identifiers for a Shell link object</summary>
    Sub GetIDList(ByRef ppidl As IntPtr)
    ''' <summary>Sets the pointer to an item identifier list (PIDL) for a Shell link object.</summary>
    Sub SetIDList(pidl As IntPtr)
    ''' <summary>Retrieves the description string for a Shell link object</summary>
    Sub GetDescription(<Out(), MarshalAs(UnmanagedType.LPWStr)> pszName As StringBuilder, cchMaxName As Integer)
    ''' <summary>Sets the description for a Shell link object. The description can be any application-defined string</summary>
    Sub SetDescription(<MarshalAs(UnmanagedType.LPWStr)> pszName As String)
    ''' <summary>Retrieves the name of the working directory for a Shell link object</summary>
    Sub GetWorkingDirectory(<Out(), MarshalAs(UnmanagedType.LPWStr)> pszDir As StringBuilder, cchMaxPath As Integer)
    ''' <summary>Sets the name of the working directory for a Shell link object</summary>
    Sub SetWorkingDirectory(<MarshalAs(UnmanagedType.LPWStr)> pszDir As String)
    ''' <summary>Retrieves the command-line arguments associated with a Shell link object</summary>
    Sub GetArguments(<Out(), MarshalAs(UnmanagedType.LPWStr)> pszArgs As StringBuilder, cchMaxPath As Integer)
    ''' <summary>Sets the command-line arguments for a Shell link object</summary>
    Sub SetArguments(<MarshalAs(UnmanagedType.LPWStr)> pszArgs As String)
    ''' <summary>Retrieves the hot key for a Shell link object</summary>
    Sub GetHotkey(ByRef pwHotkey As Short)
    ''' <summary>Sets a hot key for a Shell link object</summary>
    Sub SetHotkey(wHotkey As Short)
    ''' <summary>Retrieves the show command for a Shell link object</summary>
    Sub GetShowCmd(ByRef piShowCmd As Integer)
    ''' <summary>Sets the show command for a Shell link object. The show command sets the initial show state of the window.</summary>
    Sub SetShowCmd(iShowCmd As Integer)
    ''' <summary>Retrieves the location (path and index) of the icon for a Shell link object</summary>
    Sub GetIconLocation(<Out(), MarshalAs(UnmanagedType.LPWStr)> pszIconPath As StringBuilder, cchIconPath As Integer, ByRef piIcon As Integer)
    ''' <summary>Sets the location (path and index) of the icon for a Shell link object</summary>
    Sub SetIconLocation(<MarshalAs(UnmanagedType.LPWStr)> pszIconPath As String, iIcon As Integer)
    ''' <summary>Sets the relative path to the Shell link object</summary>
    Sub SetRelativePath(<MarshalAs(UnmanagedType.LPWStr)> pszPathRel As String, dwReserved As Integer)
    ''' <summary>Attempts to find the target of a Shell link, even if it has been moved or renamed</summary>
    Sub Resolve(hwnd As IntPtr, fFlags As SLR_FLAGS)
    ''' <summary>Sets the path and file name of a Shell link object</summary>
    Sub SetPath(<MarshalAs(UnmanagedType.LPWStr)> pszFile As String)

End Interface

<ComImport(), Guid("0000010c-0000-0000-c000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
Public Interface IPersist
    <PreserveSig()>
    Sub GetClassID(ByRef pClassID As Guid)
End Interface


<ComImport(), Guid("0000010b-0000-0000-C000-000000000046"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
Public Interface IPersistFile
    Inherits IPersist
    Shadows Sub GetClassID(ByRef pClassID As Guid)
    <PreserveSig()>
    Function IsDirty() As Integer

    <PreserveSig()>
    Sub Load(<[In](), MarshalAs(UnmanagedType.LPWStr)> pszFileName As String, dwMode As UInteger)

    <PreserveSig()>
    Sub Save(<[In](), MarshalAs(UnmanagedType.LPWStr)> pszFileName As String, <[In](), MarshalAs(UnmanagedType.Bool)> fRemember As Boolean)

    <PreserveSig()>
    Sub SaveCompleted(<[In](), MarshalAs(UnmanagedType.LPWStr)> pszFileName As String)

    <PreserveSig()>
    Sub GetCurFile(<[In](), MarshalAs(UnmanagedType.LPWStr)> ppszFileName As String)
End Interface

Const STGM_READ As UInteger = 0
Const MAX_PATH As Integer = 260

' CLSID_ShellLink from ShlGuid.h 
<ComImport(), Guid("00021401-0000-0000-C000-000000000046")> Public Class ShellLink
End Class


Public Shared Function ResolveShortcut(filename As String) As String
    Dim link As New ShellLink()
    DirectCast(link, IPersistFile).Load(filename, STGM_READ)
    ' TODO: if I can get hold of the hwnd call resolve first. This handles moved and renamed files.  
    ' ((IShellLinkW)link).Resolve(hwnd, 0) 
    Dim sb As New StringBuilder(MAX_PATH)
    Dim data As New WIN32_FIND_DATAW()
    DirectCast(link, IShellLinkW).GetPath(sb, sb.Capacity, data, 0)
    Return sb.ToString()
End Function

End Class

EDIT:

If you know a simple but efficient way to get the fullpath when driveletter changes then just I will accept the answer.

But what I don't want is to use old vb6 methods or vbs or using external apps or For loops, that's why I've tried to use apis I think is the best way for performance.

解决方案

This is only tested with a connected network drive (i won`t change my local driveletters for testing):

Public Shared Function ResolveShortcut(filename As String,hwnd As IntPtr) As String
    Dim link As New ShellLink()
    DirectCast(link, IPersistFile).Load(filename, STGM_READ)

    DirectCast(link, IShellLinkW).Resolve(hwnd, SLR_FLAGS.SLR_UPDATE)

    Dim sb As New StringBuilder(MAX_PATH)
    Dim data As New WIN32_FIND_DATAW()
    DirectCast(link, IShellLinkW).GetPath(sb, sb.Capacity, data, 0)
    Return sb.ToString()
End Function

To be called like:

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    Dim TargetFilename As String = ResolveShortcut("C:\Test.lnk",Me.Handle)
End Sub

As the documentation, you have reffered to, states :

SLR_UPDATE (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.

So passing the Handle of the form ( which the Shell will need if it needs to display some dialog ) for calling the Resolve method and passing SLR_UPDATE as second parameter, results for a connected networkdrive in the right path (at least on my site).

这篇关于使用界面的IShellLink解决这已改变了他们的驱动器盘符的快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆