|
-
July 21st, 2011, 01:28 AM
#1
waveOutOpen
I am working on codac application in Windows 7. Now somewhere in the middle this application calls this "waveOutOpen" function. But function is generating this MMSYSERR_BADDEVICEID error. In my PC no speaker is attached. The inbuilt speaker is not working. So the volume bar shows cross. But when I attach a headphone in the jack the Cross gets removed from the volumebar, that means that sound drivers are installed. Can someone tell me why this error is coming?
Code:
mr = waveOutOpen((LPHWAVEOUT)&m_hWaveOut,WAVE_MAPPER,(tWAVEFORMATEX*)&m_wavFmt,0L,0L,0L);
//if(mr != MMSYSERR_NOERROR)
if(mr == MMSYSERR_BADDEVICEID)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
0, // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
return FALSE;
/*AfxMessageBox("Sound device open error !");
return FALSE;*/
}
Although it is strange that in GetLastError it says operation completed successfully
-
July 21st, 2011, 02:38 AM
#2
Re: waveOutOpen
 Originally Posted by maverick786us
I am working on codac application in Windows 7. Now somewhere in the middle this application calls this "waveOutOpen" function. But function is generating this MMSYSERR_BADDEVICEID error.
...
Although it is strange that in GetLastError it says operation completed successfully
Where did you read that GetLastError has anything to do with waveOutOpen function? 
It has nothing! 
waveOutOpen itself returns you the error code as it very clear states in the docs:
waveOutOpen
...
Return Values
Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following.
...
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|