I have control to system volume, how i can ?
here :
http://www.askdavetaylor.com/0-blog-...me-control.png
Printable View
I have control to system volume, how i can ?
here :
http://www.askdavetaylor.com/0-blog-...me-control.png
See this: http://www.devx.com/vb2themax/Tip/19040 :wave:
Try searching the forums: http://www.vbforums.com/search.php :wave:
I don't understand your statement. I ran that code while playing an existing .mpg on my HD. It sure enough controlled the volume at system level. What is needed is... another function (when you close your app) that resets the volume to whatever it was set at prior to calling the SetVolume function,
I found this in the KPD Team API Guide and I'm posting it as is. This code reads the current system volume and also sets it. The code is raw and needs cleaning up as well as dressing up but that will leave something for you to do. A SliderControl (Vol Control) will be a nice mod. This code is also minimalist, which leaves plenty of room for you to grow it to your liking! ;)
Code:Option Explicit
'Example submitted by Danjel Nyberg KPD API Guide
'It needs a textbox (Text1) and two command buttons (Command1, Command2)
Private Declare Function waveOutSetVolume Lib "Winmm" (ByVal wDeviceID As Integer, ByVal dwVolume As Long) As Integer
Private Declare Function waveOutGetVolume Lib "Winmm" (ByVal wDeviceID As Integer, dwVolume As Long) As Integer
Private Sub Command1_Click()
Dim a, i As Long
Dim tmp As String
a = waveOutGetVolume(0, i)
tmp = "&h" & Right(Hex$(i), 4)
Text1 = CLng(tmp)
End Sub
Private Sub Command2_Click()
Dim a, i As Long
Dim tmp, vol As String
vol = Text1
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)
End Sub
Sorry, I just got the drift of what you were desiring (No system level control). I guess your going to need a MMControl in your proj unless there's another way.
i upload picture, it is what i want
for Windows 7
http://img375.imageshack.us/img375/2940/ddadasd.jpg
I found this.
http://www.vbforums.com/showthread.p...ghlight=volume
Check out post 11. Theres a download link there. I think it's using the MMControl.
Edit: No it's not using a MMControl. In fact appears to be the same code as here.
http://www.devx.com/vb2themax/Tip/19040
I haven't used a MMControl in years and when I did it wasn't much. I was quite surprised to find no volume control on it when I checked it today!
I've tried it and it works, The only problem is that the code modifies the volume of the wave, not the general volume. How ca I fix that?
Attachment 94077
I found a project on planet source code and works on windows 7 here is the project... i tried to simplify it which didnt work i will have to look into it a bit more or maybe someone could simplify it... here is the project
I've also found a code in psc.com and it works for the Volume Control. I've tried the code posted just above this post and it doesn't works for me in Xp. Maybe the code needs to be modified in some way to adapt it because vb shows some errors while compiling.
Did you load the .bas module that is missing but its actually in The folder you just need to add the file its the timer(something).bas
It workes the first time for me then did not work and it worked again once i restarted... There is something with the api's thats being mixed or not working like it should on different OS i guess not too sure i dont know anything about those api openmixer etc....
As you say, one of the *.bas files was missed and you need to add it in the project. If not, the program shows to you an error. So I loaded the bas file before running the program.