Dim strMyNull As New System.Text.StringBuilder
Dim strCkUrl As String = "http://google.com"
Dim strCkNmNull As New System.Text.StringBuilder
Dim mystr As String = Space(192)
Dim strBuffer As New System.Text.StringBuilder(mystr)
strBuffer = strBuffer.Append(mystr)
Dim CkSz As Integer = Len(mystr)
Dim lReturn As Integer = 0
lReturn = ias.IEGetProtectedModeCookie(strCkUrl, vbNullString, strBuffer, CkSz, 0)
ias.IEGetProtectedModeCookie在这里声明:
<System.Runtime.InteropServices.DllImport("ieframe.dll", SetLastError:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode)> _
Public Function IEGetProtectedModeCookie(lpszURL As String, lpszCookieName As String, pszCookieData As System.Text.StringBuilder, ByRef pcchCookieData As Integer, dwFlags As UInteger) As UInteger
End Function
答案 0 :(得分:1)
IEGetProtectedModeCookie()的返回值声明为 UInteger ,但您已将lReturn声明为整数。
UInteger = 0到4,294,967,295
整数= -2,147,483,648至2,147,483,647
IEGetProtectedModeCookie的实际返回值需要为Integer。
所以将函数声明更改为:
<System.Runtime.InteropServices.DllImport("ieframe.dll", SetLastError:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode)> _
Public Function IEGetProtectedModeCookie(lpszURL As String, lpszCookieName As String, pszCookieData As System.Text.StringBuilder, ByRef pcchCookieData As Integer, dwFlags As UInteger) As Integer
End Function