Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 343
  • Last Modified:

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?
0
poorboy
Asked:
poorboy
  • 3
  • 2
1 Solution
 
viktornetCommented:
You mean you want to open the default Windows' volume control???

//Viktor
0
 
poorboyAuthor Commented:
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?
0
 
poorboyAuthor Commented:
Adjusted points to 30
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
sjrlCommented:
You can do this via API calls, but you need to use the waveOutSetVolume function in MMSYSTEM.DLL. There is also a waveOutGetVolume function.
0
 
poorboyAuthor Commented:
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.
0
 
sjrlCommented:
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.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now