jmfmarques
Messages postés7666Date d'inscriptionsamedi 5 novembre 2005StatutMembreDernière intervention22 août 201427 9 févr. 2008 à 22:50
Bonsoir,
Il te faut également utiliser la fonction waveOutGetVolume...
Voici comment on s'y prend sous VB6 (la transposition en VB.Net n'est qu'une question de typage, s'agissant de l'utilisations directes de fonctions de l'Api de Windows !!!)
Je crois savoir que tu dois utiliser des Integer au lieux de Longs...
' Déclaration des fonctions API
Private Declare Function waveOutSetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long
Private Declare Function waveOutGetVolume Lib "winmm.dll" (ByVal uDeviceID As Long, lpdwVolume As Long) As Long
' Déclaration des constantes
Private Const SND_ASYNC = &H1
Private Const SND_NODEFAULT = &H2
Private Const SND_NOWAIT = &H2000
' Variable globale du volume
Public lgVolG As Long
Public lgVolR As Long
Public lgVol As Long
' Variable globale bidon pour les retour d'API
Public lgRep As Long
Private Sub Form_Load()
' Récupération du volume courant
lgRep = waveOutGetVolume(0, lgVol)
lgVolG = lgVol And &HFFFF&
lgVolR = ((lgVol And &HFFFF0000) / &H10000) And &HFFFF&
' Affichage du volume courant
lblVolumeG.Caption = Hex$(lgVolG)
lblVolumeR.Caption = Hex$(lgVolR)
End Sub
Private Sub cmdPlusG_Click()
' Augmente le volume du côté gauche
lgVolG = lgVolG + &H1000
If lgVolG > &HFFFF& Then lgVolG = &HFFFF&
lgRep = waveOutSetVolume(0, CLng("&H" + Hex$(lgVolR) + Hex$(lgVolG)))
lblVolumeG.Caption = Format$(Hex$(lgVolG))
End Sub
Private Sub cmdMoinsG_Click()
' Diminue le volume du côté gauche
lgVolG = lgVolG - &H1000
If lgVolG < &H0& Then lgVolG = &H0&
lgRep = waveOutSetVolume(0, CLng("&H" + Hex$(lgVolR) + Hex$(lgVolG)))
lblVolumeG.Caption = Hex$(lgVolG)
End Sub
Private Sub cmdPlusR_Click()
' Augmente le volume du côté droit
lgVolR = lgVolR + &H1000
If lgVolR > &HFFFF& Then lgVolR = &HFFFF&
lgRep = waveOutSetVolume(0, CLng("&H" + Hex$(lgVolR) + Hex$(lgVolG)))
lblVolumeR.Caption = Format$(Hex$(lgVolR))
End Sub
Private Sub cmdMoinsR_Click()
' Diminue le volume du côté droit
lgVolR = lgVolR - &H1000
If lgVolR < &H0& Then lgVolR = &H0&
lgRep = waveOutSetVolume(0, CLng("&H" + Hex$(lgVolR) + Hex$(lgVolG)))
lblVolumeR.Caption = Hex$(lgVolR)
End Sub
Tu as là tout ce qu'il te faut (à condition d'analyser, comprendre et de ne pas te contenter d'un bête copier/coller)...
kakenette
Messages postés218Date d'inscriptiondimanche 1 mai 2005StatutMembreDernière intervention15 novembre 20091 9 févr. 2008 à 18:30
Arf désolé j'oublie toujours de regarder les thread du forum, je répond directement depuis les derniers messages postés. Pour me pardonner je vais voire si je peux te trouver ca en VB 2005.
kakenette
Vous n’avez pas trouvé la réponse que vous recherchez ?
mohamed3000
Messages postés8Date d'inscriptionjeudi 19 mai 2005StatutMembreDernière intervention23 septembre 2009 9 févr. 2008 à 20:34
j ais trouver l API
Private Declare Function waveOutSetVolume Lib "WINMM.DLL" (ByVal wDeviceID As Short, ByVal dwVolume As Integer) As Short
mais ca marche pas
il augmente le son seulment droit
voila mon code
Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
Call waveOutSetVolume(0, TrackBar1.Value)