I once made an application for analyzing audio received by a standard soundcard using the Win32 Audio API. The following is the procedure I used to open a wave device:

1. Check if there is a wave-device available using: waveInGetNumDevs(). The result should be larger than zero.

2. Check if the available wave-device is capable for recording purposes, using: waveInGetDevCaps(). The result should be MMSYSERR_NOERROR.

3. Create a recording thread, put it in suspended mode first.

4. Define the wave format.

5. Open the wave device using: waveInOpen().

6. Initialise recording process. Which consist of preparing the headers, adding the buffers and starting the process using waveInStart().

The real starting of the recording begins when resuming the created recording thread.

And for stopping the recording, the thread is put to suspended again and waveInStop() and then waveInReset() are called to finish communication with the soundcard.