January 1, 2005

WinTask - UrlEscape

'
' UrlEscape - Converts characters in a URL that might be altered during transport across the Internet
'     ("unsafe" characters) into their corresponding escape sequences.
'

' Author: Joe Strazzere

'


Dim OldURL as unsigned
Dim NewURL as unsigned
Dim count as unsigned
Dim flags as unsigned

 

OldURL=Allocate(100)
NewURL=Allocate(100)
Count=Allocate(100)
Flags=Allocate(100)

 

PokeString(OldURL,"http://www.zapdata.com/arg=A B C",1)
'PokeString(OldURL,"This is a test",1)
PokeString(NewURL,"                                                                                                    ",1)

PokeInteger(Count,100,4)  ' the intial length of NewURL goes here, the new length is returned here
PokeInteger(Flags,0,4)

 

ret=External("shlwapi.dll","UrlEscapeA",OldURL,NewURL, count, flags)

msgbox(ret)

 

ret=PeekInteger(count,4)
NewURL$=PeekString$(NewURL)
msgbox(Str$(ret)+" characters ="+NewURL$)