Solved

programming mmsystem MCI_open (CD) / Wavein

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 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