void enumrateDevs() { tWAVEINCAPSA woc = new tWAVEINCAPSA(); int iNumDevs, i; /* Get the number of Digital Audio Out devices in this computer */ iNumDevs = WaveInput.waveInGetNumDevs(); /* Go through all of those devices, displaying their names */ for (i = 0; i < iNumDevs; i++) { IntPtr iptr = new IntPtr(i); /* Get info about the next device */ if (WaveInput.waveInGetDevCapsA((Int32)i, ref woc, System.Runtime.InteropServices.Marshal.SizeOf(woc)) == WaveConstants.MMSYSERR_NOERROR) { /* Display its Device ID and name */ DeviceCB.Items.Add(woc.szPname); } } }
public static extern int waveInGetDevCapsA([MarshalAsAttribute(UnmanagedType.I4)] int uDeviceID, ref tWAVEINCAPSA pwic, int cbwic);