Solved

programming mmsystem MCI_open (CD) / Wavein

Posted on 1998-09-27
5
429 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

828 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