Re: waveInOpen cannot open device



On Aug 6, 9:22 am, "Chris P." <m...@xxxxxxxxxxxx> wrote:
On Tue, 5 Aug 2008 15:21:37 -0400, Alessandro Angeli wrote:
Yes: functions provide error codes for a reason, unless
you're psychic of course. You might also want to what your
code does exactly and on what version of Windows.

Along with the complete format block that you are passing and the other
parameters.  Basically that source code chunk.  Basically you've done
something wrong and unless you show us what you've done we're not going to
be able to tell you.  

--http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]

I guess the best way is to show you what I did .sorry for having to do
it that way. I cut and pasted from my MFC application to below.

In the code, I exit the function with the first successful opening of
wave in device. The problem is that no device can open and the error
code doesn't match any of the error code constants. (in debug mode,
the error code is 11)

Please let me know what I did wrong.

WAVEFORMATEX wfx;
WAVEINCAPS wic;
HWAVEIN hwi;

wfx.wFormatTag = WAVE_FORMAT_PCM;
wfx.nChannels = 1;
wfx.nSamplesPerSec = 44100;
wfx.wBitsPerSample = 8;
wfx.nBlockAlign = wfx.wBitsPerSample*wfx.wBitsPerSample;
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec*wfx.nBlockAlign;
wfx.cbSize = 0;

MMRESULT res;
CString errmsg;
for (UINT i = 0; i < waveInGetNumDevs(); ++ i)
{
if(waveInGetDevCaps(i, &wic, sizeof WAVEINCAPS) == MMSYSERR_NOERROR)
{
if(wic.dwFormats&WAVE_FORMAT_4M08)
{
res = waveInOpen(&hwi, i, &wfx, (DWORD_PTR)waveInProc,
(DWORD_PTR)this,
CALLBACK_FUNCTION);
if(res == MMSYSERR_NOERROR)
{
return;
}
else if(res == MMSYSERR_ALLOCATED)
{
errmsg.Format("%d MMSYSERR_ALLOCATED", i);
AfxMessageBox(errmsg);
}
else if(res == MMSYSERR_BADDEVICEID)
{
errmsg.Format("%d MMSYSERR_BADDEVICEID", i);
AfxMessageBox(errmsg);
}
else if(res == MMSYSERR_NODRIVER)
{
errmsg.Format("%d MMSYSERR_NODRIVER", i);
AfxMessageBox(errmsg);
}
else if(res == MMSYSERR_NOMEM)
{
errmsg.Format("%d MMSYSERR_NOMEM", i);
AfxMessageBox(errmsg);
}
else if(res == WAVERR_BADFORMAT)
{
errmsg.Format("%d WAVERR_BADFORMAT", i);
AfxMessageBox(errmsg);
}
}
}
}
.



Relevant Pages

  • RE: Error Code: 8: 0x80004005
    ... I guess that error code was 0x80004005, ... Click services from the tab, check the check box of Hide All Microsoft ... This problem may occur if a file that the Windows Product ... This newsgroup only focuses on SBS technical issues. ...
    (microsoft.public.windows.server.sbs)
  • HELP ERROR
    ... 940 printer error code 50c help ... certificate errors internet explorer help ... computer help error message on startup ... help for microsoft windows errors ...
    (sci.geo.fluids)
  • Re: Update finally loads, but doesnt work!
    ... I downloaded and ran full scan MSRT and it found nothing. ... message when you connect to the Microsoft Windows Update Web site or to the ... See if you can download/run the MSRT manually: ... update and see if there is an error code. ...
    (microsoft.public.windowsupdate)
  • Re: Update finally loads, but doesnt work!
    ... http://aumha.net/viewforum.php?f=30 or other appropriate forums as well.** ... message when you connect to the Microsoft Windows Update Web site or to the ... ~Robear Dyer ... update and see if there is an error code. ...
    (microsoft.public.windowsupdate)
  • Re: Please Help-windows will not update -desperate
    ... Before you install IE, make sure you read the release notes: ... | Security assessment: Potential Risk ... | Windows Security Updates: 1 service packs or update rollups are missing. ... | Definition Update 1.14.1940.2 for Windows Defender Error Code: ...
    (microsoft.public.windowsupdate)

Loading