com - 是否有允许 URL 编码的 COM 可访问库?

标签 com vb6 urlencode

使用 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/

相关文章:

delphi - 实现核心音频 API 事件

vb6 - 如果 VB6 应用程序中出现运行时错误,这是否意味着错误处理已关闭?

php - rawurlencode() 和 urlencode() 在 CodeIgniter 中不起作用

java - HttpClient 重定向到带有空格抛出异常的 URL

MySQL 查询错误(ODBC 3.51)

javascript - 如何通过url传递特殊字符 '/'

c++ - 在 C++ 组件中使用 Activation Context API

c++ - COM 服务器的奇怪行为

c# - C++ 从 C# COM DLL 调用函数

windows - 为 GET_WHEEL_DELTA_WPARAM 创建 wParam