batgurl
Aug 6th, 2006, 08:45 AM
Some kind person show me how to call this in C#?
In VB6 I use:
Declare Function GX_GetDTMFKey Lib "GxVoice.dll" (ByVal ChannelNo As Integer, ByVal DTMFCount As Integer, ByRef DTMFString As Byte) As Integer
...
Dim DtmfBuffer(10) As Byte
Dim itemp As Integer
Dim ChannelNo As Integer
ChannelNo = 5
itemp = GX_GetDTMFKey(ChannelNo, 1, DtmfBuffer(0))
Works great.
In C# I try
[DllImport("GxVoice.dll", CharSet = CharSet.Auto)]
public extern static ushort GX_GetDTMFKey(ushort ChannelNo, ushort DTMFCount, char[] DTMFKey);
...
char[] DTMFKey = new char[1];
ushort i = GxVoiceAPI.GX_GetDTMFKey(5, 1, DTMFKey);
And i comes back with an error code.
Something to do with passing DTMFKey by reference?
The DLL is unmanaged legacy code.
In VB6 I use:
Declare Function GX_GetDTMFKey Lib "GxVoice.dll" (ByVal ChannelNo As Integer, ByVal DTMFCount As Integer, ByRef DTMFString As Byte) As Integer
...
Dim DtmfBuffer(10) As Byte
Dim itemp As Integer
Dim ChannelNo As Integer
ChannelNo = 5
itemp = GX_GetDTMFKey(ChannelNo, 1, DtmfBuffer(0))
Works great.
In C# I try
[DllImport("GxVoice.dll", CharSet = CharSet.Auto)]
public extern static ushort GX_GetDTMFKey(ushort ChannelNo, ushort DTMFCount, char[] DTMFKey);
...
char[] DTMFKey = new char[1];
ushort i = GxVoiceAPI.GX_GetDTMFKey(5, 1, DTMFKey);
And i comes back with an error code.
Something to do with passing DTMFKey by reference?
The DLL is unmanaged legacy code.