Solved

programming mmsystem MCI_open (CD) / Wavein

Posted on 1998-09-27
5
424 Views
Last Modified: 2013-12-03
1. opening CDAudio with MCI_OPEN
How can I get access to a specific CD-drive with mmsystem.dll´s commands ? I tried to realize it by MCI_open with MCI_open_element with lpstrelement='[Driveletter]:\track01.cda'
This works fine with win98, win95 refuses to open CDaudio-driver, posting MCIerror 296 (cannot open file with this mci-device or file corrupt.
Does Win95 not accept CDAudio as a compound device ?
Does anybody know how to get access to a specific CD-rom drive for CDAudio-services with mci-commands ?

2. WAVEINCLOSE
Openening the wavein-device via WAVEINOPEN(....) everything works fine. All WAVEIN-commands work fine except WAVEINCLOSE ! Trying to close the waveindevice I get the error message, that the given device ID is invalid although I use the Waveinhandle I received when opening the device with WAVEINOPEN.
What did I do wrong ?
How can I close the Waveindevice after opening it with WAVEINOPEN ?
THANKS
0
Comment
Question by:vader1
  • 3
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 100 total points
ID: 1414845
1. How to Address Multiple CDAudio Devices in Windows NT
http://support.microsoft.com/support/kb/articles/q137/5/79.asp

2. waveInClose expects the handle of the waveform-audio input device instead of the device ID. Make sure the value of the handle is not changed. You may use waveInGetID to get the device ID to test if the handle is valid.
0
 

Author Comment

by:vader1
ID: 1414846
question one: thank you, perfect !!!
It´s so simple, I wonder why I didn´t find out myself !?
I always tried 'D:\track01.cda' as lpstrelement...

question 2 might have been a bit misleading:

Let me try to be more precise:
I tried to open then waveindevice via:

> waveInOpen(@myWaveIn,I, @mypcmformat,caller^.hwindow,callerInstance,CALLBACK_WINDOW );

while I is goes from 0 to waveInGetNumDevs-1
and the wanted ID is selected by waveingetdevicecaps and the wanted format.
waveingetdevicecaps reports that device ID 0 is able to support my format.
The selected waveinid in my system then is 0.
according to this, the result from
getid(mywavein,ID) is 0

The "mywavein" handle works fine, but trying to close the device via
> waveInClose(@mywavein);

I get the message:
"error 005 the device-access-number you used is invalid"
So did I use the wrong ID to open the device ?
(By the way, the "WAVE_MAPPER"-Constant does not work as an ID, because my compiler tells me that it´s out of range...)
Thanks a lot for your help so far...


0
 
LVL 23

Expert Comment

by:chensu
ID: 1414847
The first parameter of waveInOpen is of type LPHWAVEIN while the first parameter of waveInClose is of type HWAVEIN. It looks like from your code that you passed the wrong value. Shouldn't it be

waveInClose(mywavein);

?
0
 

Author Comment

by:vader1
ID: 1414848
Thanks for adding your comment !
Actually it didn´t exactly solve my problem, but thanks to you I started thinking about it again. Now I found a way to fix the problem (I think the problem is an error in the mmsystem.hlp´s description of the waveinclose-function, so I might not be the only one to encounter this problem):

var
mywavein:HWaveIn; ** a handle (!!)

function waveInClose(hWaveIn: PHWaveIn (!!??)): Word;
HWAVEIN : hWaveIn (!!??) ** THIS IS A CONTRADICTION, ISN`T IT ??
Specifies a handle (!!??) to the waveform input device.

** actually the function requires a PHWavein , as the function does not accept the actual waveinHANDLE

I tried to do it by:
waveInClose(@mywavein);
which did NOT work,

So i changed it to:
waveInClose(PHWavein(mywavein));
which works fine !

Thanks for helping me !
0
 
LVL 23

Expert Comment

by:chensu
ID: 1414849
Apparently, your documentation is wrong.

According to the Microsoft Platform SDK documentation, the function prototype is

MMRESULT waveInClose(HWAVEIN hwi);
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Fix insertion and shifting issue 5 60
SAPE.heur.AE935 Visual Studio 3 36
Poor Man's .NET Framework Certification 2 47
Problem to open text file 11 69
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now