Search code examples
vb6windows-7windows-vistawindows-xpmicrophone

How to detect if a Microphone is present


I just had a very long tech support call because a customer didn't have a Mic on their laptop. (Stupid me: they said they'd used the mic earlier and I have never heard of a laptop not having a Mic).

I'm wondering if there is a way to detect whether there is a Microphone (recording capability) on Windows XP, Vista, 7.

(I've got error handling enabled and it logs the error and then exits the Function but the app just crashes on Windows 7 if there's no Microphone. )


Solution

  • I think the only way you will be able to do this in VB 6 is through Direct X:

    http://msdn.microsoft.com/en-us/library/bb318770(VS.85).aspx

    You can check this out:

    http://msdn.microsoft.com/en-us/library/bb280815(VS.85).aspx

    CaptureDevices Collection Class (Microsoft.DirectX.DirectSound)

    http://msdn.microsoft.com/en-us/library/ms810619.aspx

    you can also call dxdiag..