You can use some Windows API functions.the name like wave- or snd-. you can find in a VB tool named API Viewer.

解决方案 »

  1.   

    ‘初始化:        ' Open Input Wave Device, Let WAVE_MAPPER Pick The Best Device...
            l = waveInOpen(hWaveIn, WAVE_MAPPER, mWaveInFmt, 0, 0, CALLBACK_NULL)
            'l = waveInOpen(hWaveIn, WAVE_MAPPER, mWaveInFmt, AddressOf waveInProc, App.hInstance, CALLBACK_FUNCTION)
            If l Then Err.Raise 68, , "不能打开音频输出设备"
            
            l = mWaveInFmt.nAvgBytesPerSec / CAPTURE_RATE * 2
            InitWaveHDR mWaveInHDR, l
          
            l = waveInPrepareHeader(hWaveIn, mWaveInHDR, Len(mWaveInHDR)) ' Validate Return Code
    '检查'do not changed any in this function for speed reason
    Private Sub CheckInBuf(WaveInHDR As WAVEHDR)
        With WaveInHDR
            If (.dwFlags And WHDR_DONE) = WHDR_DONE Then
                
                Dim l As Long
                l = .dwBytesRecorded
                If l > 0 Then
                    
                    Dim bt() As Byte
                    ReDim bt(l - 1)
                    
                    CopyMemory bt(0), ByVal .lpData, l
                    
                    Dim b As Boolean
                    b = True
                    
                    'b = (Year(Date) < 2001)
                End If
                
                l = waveInAddBuffer(hWaveIn, WaveInHDR, Len(WaveInHDR)) ' Validate Return Code
                If b Then
                    RaiseEvent Frame(bt)
                End If
            End If
        End WithEnd Sub