Link to home
Start Free TrialLog in
Avatar of poorboy
poorboy

asked on

mciSendString

Using VB5 and the API call (mciSendString), i have built a CD player. Everything works fine except i want to add a
volume control to the program using the same API call. I
can't figure out how to do that one. Could you show me how
this is done?
Avatar of viktornet
viktornet
Flag of United States of America image

You mean you want to open the default Windows' volume control???

//Viktor
Avatar of poorboy
poorboy

ASKER

I have placed a SLIDER CONTROL on my form and i would like to change the volume
using it. Is there an API call i can use to do this?
Avatar of poorboy

ASKER

Adjusted points to 30
ASKER CERTIFIED SOLUTION
Avatar of sjrl
sjrl

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of poorboy

ASKER

The API call waveOutSetVolume and waveOutGetVolume are new to me. Both functions
are indentical except for one letter. Here is the full function call for one of them.
"Declare Function waveOutSetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long" Could you tell me how to get the (uDeviceID) in the call.
I assume that (dwVolume) means the value of my slider control. If this is wrong please let me know.
I think you need to use the waveOutGetNumDevs to find out how many playback devices there are. Then use the waveOutGetDevCaps to iterate through these until you find the desired device number. This number is uDeviceID.
dwVolume is a DWORD. The loworder word specifies the left channel, the high order the right.
So 0xFF00 represents silence on the left, full volume on the right.
0x00FF represents silence on the right, full volume on the left.
0xFFFF represents silence on the left, full volume on the right.
0x0000 represents silence.
0xFFFF represents full volume.