Ramzes писал(а):Dmitriy Solomnikov
да, есть... ToString
Public Shared Function ParceURI(ByVal URI As String)
If URI.IndexOf("file:///") = -1 Then
Return Nothing
End If
Dim s As String = Microsoft.VisualBasic.Right(URI, URI.Length - 8)
s = Microsoft.VisualBasic.Replace(s, "/", "")
If System.IO.File.Exists(s) = False Then
s = Nothing
End If
Return s
End Function
Option Explicit
Public Const MAX_PATH = 260
'Takes a file URL and converts it to a Microsoft MS-DOS path
'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/shlwapi/path/pathcreatefromurl.asp
Public Declare Function PathCreateFromUrlA _
Lib "shlwapi.dll" ( _
ByVal pszUrl As String, _
ByVal pszPath As String, _
ByRef pcchPath As Long, _
ByVal dwReserved As Long _
) As Long
Public Function PathCreateFromUrl(ByVal URL As String) As String
Dim res As Long
Dim Path As String
Dim PathLen As Long
Path = Space$(MAX_PATH)
PathLen = MAX_PATH
res = PathCreateFromUrlA(URL, Path, PathLen, 0)
If (res = 0) Then PathCreateFromUrl = Left$(Path, PathLen)
End Function
?PathCreateFromUrl("file:///C:/h%20x.xml")
C:\h x.xml
Dim u As New Uri("file:///C:/h%20x.xml")
Console.WriteLine(u.LocalPath)
..................
Dim res As IntPtr
res = PathCreateFromUrlA("file:///C:/h.xml", Path, PathLen, 0)
Dmitriy Solomnikov писал(а):HRESULT - это в какой тип преобразуется (и что из себя представляет)?
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 95