T
~toki
I'm triyng to use this function
int result = NativeMethods.midiOutGetDevCaps( -1, ref pSI,
(uint)Marshal.SizeOf(pSI) );
Docs say that pSI is a struct (below)
[c++]
typedef struct {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
CHAR szPname[MAXPNAMELEN]; // Here's the problem
WORD wTechnology;
WORD wVoices;
WORD wNotes;
WORD wChannelMask;
DWORD dwSupport;
} MIDIOUTCAPS;
This is my code in c#
[C#]
public struct MIDIOUTCAPS {
public int wMid;
public int wPid;
public long vDriverVersion;
public char[] szPname; // Here's the problem
public int wTechnology;
public int wVoices;
public int wNotes;
public int wChannelMask;
public long dwSupport;
}
MIDIOUTCAPS pSI = new MIDIOUTCAPS();
pSI.szPname = new char[32];
int result = NativeMethods.midiOutGetDevCaps( -1, ref pSI,
(uint)Marshal.SizeOf(pSI) );
This code, give me a nullreference error (the callback stop in the
Kernel32.dll)
If i change "public char[] szPname; X public char szPname;" works fine
(don't retrieve the szPname) (I rename too, of course, pSI.szPname = new
char[32]
"CHAR szPname[MAXPNAMELEN];" is a null-terminated string
Some idea?
int result = NativeMethods.midiOutGetDevCaps( -1, ref pSI,
(uint)Marshal.SizeOf(pSI) );
Docs say that pSI is a struct (below)
[c++]
typedef struct {
WORD wMid;
WORD wPid;
MMVERSION vDriverVersion;
CHAR szPname[MAXPNAMELEN]; // Here's the problem
WORD wTechnology;
WORD wVoices;
WORD wNotes;
WORD wChannelMask;
DWORD dwSupport;
} MIDIOUTCAPS;
This is my code in c#
[C#]
public struct MIDIOUTCAPS {
public int wMid;
public int wPid;
public long vDriverVersion;
public char[] szPname; // Here's the problem
public int wTechnology;
public int wVoices;
public int wNotes;
public int wChannelMask;
public long dwSupport;
}
MIDIOUTCAPS pSI = new MIDIOUTCAPS();
pSI.szPname = new char[32];
int result = NativeMethods.midiOutGetDevCaps( -1, ref pSI,
(uint)Marshal.SizeOf(pSI) );
This code, give me a nullreference error (the callback stop in the
Kernel32.dll)
If i change "public char[] szPname; X public char szPname;" works fine
(don't retrieve the szPname) (I rename too, of course, pSI.szPname = new
char[32]

"CHAR szPname[MAXPNAMELEN];" is a null-terminated string
Some idea?