Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

programming mmsystem MCI_open (CD) / Wavein

Posted on 1998-09-27
5
Medium Priority
?
442 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 300 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

916 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