如何将这个VB.net声明转换为VB6样式的等价物,这个过程是什么?

时间:2013-06-09 11:44:52

标签: 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

那些marshalas看起来很丑陋

为了比较,典型的vb6风格是:

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

没有编组这个没有任何东西的元帅。我怎么转过来?

这是正确的方法吗?

Declare Function IEGetProtectedModeCookie Lib "ieframe.dll" (ByVal lpszURL As String, ByVal lpszCookieName As String, ByVal pszCookieData As System.Text.StringBuilder, ByRef pcchCookieData As UInteger, ByVal dwFlags As UInteger) As Integer

0 个答案:

没有答案