使用 VB6。自己动手并不难,但我想知道是否有预制的?
最佳答案
根据 Bob 的评论提示:Google 为 UrlEscape 找到了这个包装器在newsgroup post来自卡尔·彼得森。
Private Declare Function UrlEscape Lib "Shlwapi.dll" Alias "UrlEscapeA" ( _
ByVal pszURL As String, ByVal pszEscaped As String, ByRef pcchEscaped As Long, _
ByVal dwFlags As Long) As Long
Private Const URL_DONT_ESCAPE_EXTRA_INFO As Long = &H2000000
Private Function EscapeURL(ByVal URL As String) As String
' Purpose: A thin wrapper for the URLEscape API function. '
Dim EscTxt As String
Dim nLen As Long
' Create a maximum sized buffer. '
nLen = Len(URL) * 3
EscTxt = Space$(nLen)
If UrlEscape(URL, EscTxt, nLen, URL_DONT_ESCAPE_EXTRA_INFO) = 0 Then
EscapeURL = Left$(EscTxt, nLen)
End If
End Function
免责声明:我自己还没有尝试过这段代码。
关于com - 是否有允许 URL 编码的 COM 可访问库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1986885/