I wish to call an unmanaged function from vb delacred as so:
#define DllExport __declspec(dlle xport)
DllExport int WINAPI DllAlcWrite(HAN DLE, 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 strOutgoingBuff er As String
strOutgoingBuff er ="FOO"
intReturn = DllAlcWrite(m_H andle, strOutgoingBuff er, 3)
2.)
<DllImport("alc sapi.dll")> _
Private Shared Function DllAlcWrite(ByV al hConn As Long, ByVal
strGWOutgoing As String, ByVal intStringLength As Integer) As Integer
End Function
<VBFixedString( 255)> Private strOutgoingBuff er As String
strOutgoingBuff er ="FOO"
intReturn = DllAlcWrite(m_H andle, strOutgoingBuff er, 3)
3.)
<DllImport("alc sapi.dll", CharSet:=CharSe t.Ansi,
CallingConventi on:=CallingConv ention.Cdecl)> _
Private Shared Function DllAlcWrite(ByV al hConn As Long, ByVal
strGWOutgoing As String, ByVal intStringLength As Integer) As Integer
End Function
<VBFixedString( 255)> Private strOutgoingBuff er As String
strOutgoingBuff er ="FOO"
intReturn = DllAlcWrite(m_H andle, strOutgoingBuff er, 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(dlle xport)
DllExport int WINAPI DllAlcWrite(HAN DLE, 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 strOutgoingBuff er As String
strOutgoingBuff er ="FOO"
intReturn = DllAlcWrite(m_H andle, strOutgoingBuff er, 3)
2.)
<DllImport("alc sapi.dll")> _
Private Shared Function DllAlcWrite(ByV al hConn As Long, ByVal
strGWOutgoing As String, ByVal intStringLength As Integer) As Integer
End Function
<VBFixedString( 255)> Private strOutgoingBuff er As String
strOutgoingBuff er ="FOO"
intReturn = DllAlcWrite(m_H andle, strOutgoingBuff er, 3)
3.)
<DllImport("alc sapi.dll", CharSet:=CharSe t.Ansi,
CallingConventi on:=CallingConv ention.Cdecl)> _
Private Shared Function DllAlcWrite(ByV al hConn As Long, ByVal
strGWOutgoing As String, ByVal intStringLength As Integer) As Integer
End Function
<VBFixedString( 255)> Private strOutgoingBuff er As String
strOutgoingBuff er ="FOO"
intReturn = DllAlcWrite(m_H andle, strOutgoingBuff er, 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!
Comment