R
Rafiqah Abd.Rahman via DotNetMonster.com
I want to pass in an array of structures using a P/Invoke function. But
they currently give me a non-supported exception.How to solve this? Please
reply to me asap.I need the codes urgently!!
These are my codes.
These are at the wrapper class
==============================
<StructLayout(LayoutKind.Sequential, Size:=4)> _
Public Structure SSFT_ENGINE
'szEngine is a string
Public szEngine As StringPtr
'szSymbolicName is a string
Public szSymbolicName As StringPtr
Public eTechnology As SSFT_TECHNOLOGY
'szVersion is a string
Public szVersion As StringPtr
End Structure
<DllImport("rssoloapi.dll", EntryPoint:="ssft_ttsGetEngineList")> _
Public Shared Function ssft_ttsGetEngineList( _
ByRef hSpeech As SSFT_HSAFE, _
ByVal technology As SSFT_TECHNOLOGY, _
ByRef pEngines() As SSFT_ENGINE, _
ByRef numOfElements As Int32) As Integer
End Function
These codes are at the Form side
================================
SSFT_ERROR = ssft_ttsGetEngineList
(hSpeech,SSFT_TECHNOLOGY.SSFT_TECHNOLOGY_TTS, _
engines, Convert.ToInt32(NUM_ENGINES))
Label1.Text &= "Result of ssft_ttsGetEngineList :" & _
SSFT_ERROR.ToString & vbCrLf
they currently give me a non-supported exception.How to solve this? Please
reply to me asap.I need the codes urgently!!
These are my codes.
These are at the wrapper class
==============================
<StructLayout(LayoutKind.Sequential, Size:=4)> _
Public Structure SSFT_ENGINE
'szEngine is a string
Public szEngine As StringPtr
'szSymbolicName is a string
Public szSymbolicName As StringPtr
Public eTechnology As SSFT_TECHNOLOGY
'szVersion is a string
Public szVersion As StringPtr
End Structure
<DllImport("rssoloapi.dll", EntryPoint:="ssft_ttsGetEngineList")> _
Public Shared Function ssft_ttsGetEngineList( _
ByRef hSpeech As SSFT_HSAFE, _
ByVal technology As SSFT_TECHNOLOGY, _
ByRef pEngines() As SSFT_ENGINE, _
ByRef numOfElements As Int32) As Integer
End Function
These codes are at the Form side
================================
SSFT_ERROR = ssft_ttsGetEngineList
(hSpeech,SSFT_TECHNOLOGY.SSFT_TECHNOLOGY_TTS, _
engines, Convert.ToInt32(NUM_ENGINES))
Label1.Text &= "Result of ssft_ttsGetEngineList :" & _
SSFT_ERROR.ToString & vbCrLf