S
Sakharam Phapale
Hi All,
I have written following code, but waveInOpen API call gives me error no 32.
Can anyone help me to solve this?
Public Delegate Function callback(ByVal hw As Integer, ByVal uMsg As
Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Public Const CALLBACK_FUNCTION = &H30000
Structure WAVEFORMAT
Dim wFormatTag As Integer
Dim nChannels As Integer
Dim nSamplesPerSec As Integer
Dim nAvgBytesPerSec As Integer
Dim nBlockAlign As Integer
Dim wBitsPerSample As Integer
Dim cbSize As Integer
End Structure
Declare Function waveInOpen Lib "winmm.dll" (ByRef lphWaveIn As IntPtr, _
ByVal uDeviceID As Integer, ByRef lpFormat As WAVEFORMAT, _
ByVal dwCallback As callback, ByVal dwInstance As Integer, _
ByVal dwFlags As Integer) As Integer
Dim Wfmt As WAVEFORMAT
Dim WHdr As WAVEHDR
Dim intWaveIn As IntPtr
Dim intDevID As Integer = 0
Dim intRet As Integer
With Wfmt
..wFormatTag = 1
..nChannels = 1
..nBlockAlign = 1
..nSamplesPerSec = 8000
..nAvgBytesPerSec = 8000
..wBitsPerSample = 8
..cbSize = 0
End With
Dim Buffer(2048) As Byte
Dim Handle As GCHandle = GCHandle.Alloc(Buffer, GCHandleType.Pinned)
Dim ptrBuffer As IntPtr = Handle.AddrOfPinnedObject
intRet = waveInOpen(intWaveIn, intDevID, Wfmt, AddressOf WaveInProc, 0,
CALLBACK_FUNCTION)
intRet comes as 32.
Hopes kind help from you.
Thanks & Regards.
Sakharam Phapale
I have written following code, but waveInOpen API call gives me error no 32.
Can anyone help me to solve this?
Public Delegate Function callback(ByVal hw As Integer, ByVal uMsg As
Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Public Const CALLBACK_FUNCTION = &H30000
Structure WAVEFORMAT
Dim wFormatTag As Integer
Dim nChannels As Integer
Dim nSamplesPerSec As Integer
Dim nAvgBytesPerSec As Integer
Dim nBlockAlign As Integer
Dim wBitsPerSample As Integer
Dim cbSize As Integer
End Structure
Declare Function waveInOpen Lib "winmm.dll" (ByRef lphWaveIn As IntPtr, _
ByVal uDeviceID As Integer, ByRef lpFormat As WAVEFORMAT, _
ByVal dwCallback As callback, ByVal dwInstance As Integer, _
ByVal dwFlags As Integer) As Integer
Dim Wfmt As WAVEFORMAT
Dim WHdr As WAVEHDR
Dim intWaveIn As IntPtr
Dim intDevID As Integer = 0
Dim intRet As Integer
With Wfmt
..wFormatTag = 1
..nChannels = 1
..nBlockAlign = 1
..nSamplesPerSec = 8000
..nAvgBytesPerSec = 8000
..wBitsPerSample = 8
..cbSize = 0
End With
Dim Buffer(2048) As Byte
Dim Handle As GCHandle = GCHandle.Alloc(Buffer, GCHandleType.Pinned)
Dim ptrBuffer As IntPtr = Handle.AddrOfPinnedObject
intRet = waveInOpen(intWaveIn, intDevID, Wfmt, AddressOf WaveInProc, 0,
CALLBACK_FUNCTION)
intRet comes as 32.
Hopes kind help from you.
Thanks & Regards.
Sakharam Phapale