Const MAX_PATH As Integer = 260 Const S_OK As Integer = &H0 <DllImport("shell32.dll", SetLastError:=True, CharSet:=CharSet.Unicode)> Function SHGetPathFromIDList(ByVal pidl As IntPtr, ByVal pszPath As StringBuilder) As Boolean End Function <DllImport("shell32.dll", SetLastError:=True, CharSet:=CharSet.Unicode)> Function SHParseDisplayName(<MarshalAs(UnmanagedType.LPWStr)> ByVal pszName As String, byvalpbc As IntPtr, ByRef ppidl As IntPtr, ByVal sfgaoIn As UInteger, ByRef psfgaoOut As UInteger) As Integer End Function Function FixPathCase(ByVal path As String) As String Dim newPath As New StringBuilder(MAX_PATH) Dim ppidl As IntPtr Dim psfgaoOut As UInteger Dim result As Integer = SHParseDisplayName(path, IntPtr.Zero, ppidl, 0&, psfgaoOut) If result = S_OK Then Dim r As Boolean = SHGetPathFromIDList(ppidl, newPath) Marshal.FreeCoTaskMem(ppidl) If Not r Then Throw New Win32Exception(Marshal.GetLastWin32Error()) Else Throw New Win32Exception(result) End If Return newPath.ToString() End Function
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.