Solved

mciSendString

Posted on 1998-09-09
6
328 Views
Last Modified: 2010-05-18
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
Comment
Question by:poorboy
  • 3
  • 2
6 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1434007
You mean you want to open the default Windows' volume control???

//Viktor
0
 

Author Comment

by:poorboy
ID: 1434008
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
 

Author Comment

by:poorboy
ID: 1434009
Adjusted points to 30
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Accepted Solution

by:
sjrl earned 30 total points
ID: 1434010
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
 

Author Comment

by:poorboy
ID: 1434011
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
 

Expert Comment

by:sjrl
ID: 1434012
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

776 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