[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct MIDIOUTCAPS
{
public int wMid;
public int wPid;
public long vDriverVersion;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 300)]
public string szPname; // Here's the problem
public int wTechnology;
public int wVoices;
public int wNotes;
public int wChannelMask;
public long dwSupport;
} w=midiOutGetDevCaps(i, out midioutcaps, Marshal.SizeOf(midioutcaps)); comboBox1.Items.Add(midioutcaps.szPname.ToString());为什么运行后,combox里不能完全显示结构中的szpname字符串,只显示szpname的一半字符,哪里出了问题,求助??
public struct MIDIOUTCAPS
{
public int wMid;
public int wPid;
public long vDriverVersion;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 300)]
public string szPname; // Here's the problem
public int wTechnology;
public int wVoices;
public int wNotes;
public int wChannelMask;
public long dwSupport;
} w=midiOutGetDevCaps(i, out midioutcaps, Marshal.SizeOf(midioutcaps)); comboBox1.Items.Add(midioutcaps.szPname.ToString());为什么运行后,combox里不能完全显示结构中的szpname字符串,只显示szpname的一半字符,哪里出了问题,求助??
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货