Results 1 to 5 of 5

Thread: Windows Explorer Location URL character

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2008
    Location
    Turkey
    Posts
    37

    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


    it send a unknown characters like %20 ?

    [Sorry For my English]

    Thanks...

  2. #2
    Fanatic Member FireXtol's Avatar
    Join Date
    Apr 2010
    Posts
    874

    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'.

  3. #3
    Lively Member claiyah's Avatar
    Join Date
    Apr 2010
    Location
    Tunisia
    Posts
    79

    Re: Windows Explorer Location URL character

    with replace your code must resembled his
    vb Code:
    1. public function getWindowList
    2. Dim app, mx
    3. Set app = CreateObject("Shell.Application")
    4. Set mx = app.Windows
    5. For Each st In mx
    6. MsgBox "Title:" & st.LocationName & vbNewLine & "Adress:" & replace(st.LocationUrl,"%20", " ")
    7. Next
    8. end function

  4. #4

    Thread Starter
    Member
    Join Date
    Sep 2008
    Location
    Turkey
    Posts
    37

    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
    Last edited by mustiback; May 5th, 2010 at 02:06 PM.

  5. #5
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width