Windows Explorer Location URL character
Hello Everybody.
i'm trying to list windows explorer opened windows and opened windows adress in vb6 But i have a this problem.
When i get LocationURL it return unknown characters in adress text.
Code:
Code:
public function getWindowList
Dim app, mx
Set app = CreateObject("Shell.Application")
Set mx = app.Windows
For Each st In mx
MsgBox "Title:" & st.LocationName & vbNewLine & "Adress:" & st.LocationUrl
Next
end function
http://img687.imageshack.us/img687/143/tstz.jpg
it send a unknown characters like %20 ?
[Sorry For my English]
Thanks...
Re: Windows Explorer Location URL character
%20 means "this is hex(%): 20", which is a space.
You can do: newfilename = Replace(filename, "%20", " ") to turn them into spaces.
A better way would be to locate %, grab the two characters after it, and convert the hex into asc, if you really want it 'pretty printed'.
Re: Windows Explorer Location URL character
with replace your code must resembled his
vb Code:
public function getWindowList
Dim app, mx
Set app = CreateObject("Shell.Application")
Set mx = app.Windows
For Each st In mx
MsgBox "Title:" & st.LocationName & vbNewLine & "Adress:" & replace(st.LocationUrl,"%20", " ")
Next
end function
Re: Windows Explorer Location URL character
Now i do This...
Code:
Public Function parsepath(ByVal path As String) As String
Dim sonuc As String
sonuc = path
sonuc = Replace(sonuc, "%20", " ")
sonuc = Replace(sonuc, "file:///", "")
sonuc = Replace(sonuc, "/", "\")
sonuc = Replace(sonuc, "%E7", "ç")
sonuc = Replace(sonuc, "%F6", "ö")
sonuc = Replace(sonuc, "%FC", "ü")
sonuc = Replace(sonuc, "%C7", "Ç")
sonuc = Replace(sonuc, "%D6", "Ö")
sonuc = Replace(sonuc, "%DC", "Ü")
parsepath = sonuc
End Function
Thanks Everybody :)
Re: Windows Explorer Location URL character
Another possibility:
Code:
Function Unescape(ByVal Escaped As String) As String
Dim strSegments() As String
Dim intSegment As Integer
strSegments = Split(Escaped, "%")
For intSegment = 1 To UBound(strSegments)
strSegments(intSegment) = _
Chr$(CInt("&H0" & Left$(strSegments(intSegment), 2))) _
& Mid$(strSegments(intSegment), 3)
Next
Unescape = Join$(strSegments, "")
End Function