I need some help. The following third-part VB6 code works:
Type cdSourceInfo
SourceType As Long
rsrvd As Long Name As String * 64
NameInOS As String * 64
PortType As Long
u As cdPortDescripUnion
End Type
Declare Function CDEnumDeviceNext Lib "CDSDK.dll" (ByVal hEnum As Long,
ByRef pSourceInfo As cdSourceInfo) As Long
Private SourceInfo As cdSourceInfo
err = CDEnumDeviceNext(hEnum, SourceInfo)
The dll is unmanaged.
My conversion of this is:
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> Structure
cdSourceInfo
Public SourceType As Integer
Public rsrvd As Integer
<VBFixedString(64)> Public Name As String
<VBFixedString(64)> Public NameInOS As String Public PortType As Integer
Public u As cdPortDescripUnion
End Structure
Declare Function CDEnumDeviceNext Lib "CDSDK.dll" (ByVal hEnum As Integer,
ByRef pSourceInfo As cdSourceInfo) As Integer
Private m_sourceInfo As cdSourceInfo
SourceInfo = New cdSourceInfo()
err = CDEnumDeviceNext(hEnum, SourceInfo)
I get a null-reference exception here.
Can someone guess as to what I'm doing wrong?
Ken