如何在vb.net中声明IEGetProtectedModeCookie?

时间:2013-06-09 11:37:01

标签: vb.net

<DllImport("ieframe.dll", EntryPoint:="IEGetProtectedModeCookie")> _
Public Function IEGetProtectedModeCookie( _
    <[In](), MarshalAs(UnmanagedType.LPWStr)> ByVal lpszURL As String, _
    <[In](), MarshalAs(UnmanagedType.LPWStr)> ByVal lpszCookieName As String, _
    <MarshalAs(UnmanagedType.LPWStr)> ByVal pszCookieData As StringBuilder, _
    ByRef pcchCookieData As UInteger, _
    ByVal dwFlags As UInteger) As Integer
End Function

首先,这似乎与我的常规API声明

非常不同
Declare Function InternetGetCookieEx Lib "wininet.dll" Alias "InternetGetCookieExA" (ByVal pchURL As String, ByVal pchCookieName As String, ByVal pchCookieData As String, ByRef pcchCookieData As System.UInt32, ByVal dwFlags As System.UInt32, ByVal lpReserved As Integer) As Boolean

然而它根本就没有编译。 StringBuilder未定义。 MarshalAs没有定义。在没有定义。我想知道我应该包含或导入什么来使它们工作。

1 个答案:

答案 0 :(得分:0)

这是声明API函数的.Net方式 (Declare Function继承自VB6)

您需要导入System.TextSystem.Runtime.InteropServices