title: C# How to get names of sound input
body: <p>I want to get user-friendly names of sound inputs with this code, but it can give me only first 32 chars of name, but I want it whole.</p>
  
  <pre><code>[DllImport("winmm.dll", SetLastError = true)]
  static extern uint waveInGetNumDevs();
  
  [DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)]
  public static extern uint waveInGetDevCaps(uint hwo, ref WAVEOUTCAPS pwoc, uint cbwoc);
  
  [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
  public struct WAVEOUTCAPS
  {
      public ushort wMid;
      public ushort wPid;
      public uint vDriverVersion;
      [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
      public string szPname;
      public uint dwFormats;
      public ushort wChannels;
      public ushort wReserved1;
      public uint dwSupport;
  }
  
  public static string[] GetSoundDevices()
  {
      uint devices = waveInGetNumDevs();
      string[] result = new string[devices];
      WAVEOUTCAPS caps = new WAVEOUTCAPS();
      using (StreamWriter sw = new StreamWriter("appdata/audio/name"))
      {
          for (uint i = 0; i &lt; devices; i++)
          {
              waveInGetDevCaps(i, ref caps, (uint)Marshal.SizeOf(caps));
              result[i] = caps.szPname;
              sw.WriteLine(caps.szPname);
          }
          return result;
      }
  }
  </code></pre>
  
  <p>I need this names of sound inputs:
  <img src="https://i.stack.imgur.com/h6CXz.png" alt="enter image description here"></p>
  
  <p>but this code give me only this: </p>
  
  <p><img src="https://i.stack.imgur.com/K15sH.png" alt="enter image description here"></p>
  
  <p>Thank you guys!</p>