vb.net调用非托管函数aa.dll,aa.dll包括2个入参数,2个出参数。请教怎么调用?解决送100分
在VC++中调用
定义 int GetContent(IN char* lpszURL, IN char* lpszSubject, OUT char* lpszPushContent, OUT int &nTotalPacket);
调用 int rc = GetContent((char *)(LPCTSTR)m_strURL, (char *)(LPCTSTR)m_strSubject, szContent, nPacketCount);
在VB.net中如何调用???
------------------------------------
本人试验
<DllImport("aa.DLL", EntryPoint:="GetContent", SetLastError:=True, CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> Public Shared Function GetContents(ByVal src As String, ByVal dst As String, ByVal contents As String, ByVal intpage As Integer) As Integer
' Leave function empty - DllImport attribute forces calls
End Function
调用时 RetVal = GetContents(sendurl.Text, sendtext.Text, contents, intpage)
提示:调用行 :未将对象引用设置到对象的实例。
------------------------------------------
如果这样
<DllImport("aa.DLL", EntryPoint:="GetContent", SetLastError:=True, CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> Public Shared Function GetContents(ByVal src As String, ByVal dst As String) As Integer
' Leave function empty - DllImport attribute forces calls
End Function
调用时 RetVal = GetContents(sendurl.Text, sendtext.Text)
倒是可以调用,但无法 得到函数返回值...