J
John Lucas
I wish to call an unmanaged function from vb delacred as so:
#define DllExport __declspec(dllexport)
DllExport int WINAPI DllAlcWrite(HANDLE, LPCSTR, int);
I have tried:
1.)
Private Declare Ansi Function DllAlcWrite Lib "alcsapi" (ByVal hConn
As Long, ByVal strGWOutgoing As String, ByVal intStringLength As
Integer) As Integer
<VBFixedString(255)> Private strOutgoingBuffer As String
strOutgoingBuffer ="FOO"
intReturn = DllAlcWrite(m_Handle, strOutgoingBuffer, 3)
2.)
<DllImport("alcsapi.dll")> _
Private Shared Function DllAlcWrite(ByVal hConn As Long, ByVal
strGWOutgoing As String, ByVal intStringLength As Integer) As Integer
End Function
<VBFixedString(255)> Private strOutgoingBuffer As String
strOutgoingBuffer ="FOO"
intReturn = DllAlcWrite(m_Handle, strOutgoingBuffer, 3)
3.)
<DllImport("alcsapi.dll", CharSet:=CharSet.Ansi,
CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Function DllAlcWrite(ByVal hConn As Long, ByVal
strGWOutgoing As String, ByVal intStringLength As Integer) As Integer
End Function
<VBFixedString(255)> Private strOutgoingBuffer As String
strOutgoingBuffer ="FOO"
intReturn = DllAlcWrite(m_Handle, strOutgoingBuffer, 3)
( i know the handle is long, but it is working for other functions in
this dll)
I have also tried setting the string length (3rd parm)to 255
I am able to call other functions in this dll ok
=================================
All of them generate the NullReference exception. Is there a way to
properly marshal LPCSTR?
Help!
#define DllExport __declspec(dllexport)
DllExport int WINAPI DllAlcWrite(HANDLE, LPCSTR, int);
I have tried:
1.)
Private Declare Ansi Function DllAlcWrite Lib "alcsapi" (ByVal hConn
As Long, ByVal strGWOutgoing As String, ByVal intStringLength As
Integer) As Integer
<VBFixedString(255)> Private strOutgoingBuffer As String
strOutgoingBuffer ="FOO"
intReturn = DllAlcWrite(m_Handle, strOutgoingBuffer, 3)
2.)
<DllImport("alcsapi.dll")> _
Private Shared Function DllAlcWrite(ByVal hConn As Long, ByVal
strGWOutgoing As String, ByVal intStringLength As Integer) As Integer
End Function
<VBFixedString(255)> Private strOutgoingBuffer As String
strOutgoingBuffer ="FOO"
intReturn = DllAlcWrite(m_Handle, strOutgoingBuffer, 3)
3.)
<DllImport("alcsapi.dll", CharSet:=CharSet.Ansi,
CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Function DllAlcWrite(ByVal hConn As Long, ByVal
strGWOutgoing As String, ByVal intStringLength As Integer) As Integer
End Function
<VBFixedString(255)> Private strOutgoingBuffer As String
strOutgoingBuffer ="FOO"
intReturn = DllAlcWrite(m_Handle, strOutgoingBuffer, 3)
( i know the handle is long, but it is working for other functions in
this dll)
I have also tried setting the string length (3rd parm)to 255
I am able to call other functions in this dll ok
=================================
All of them generate the NullReference exception. Is there a way to
properly marshal LPCSTR?
Help!