Programación General > Visual Basic 6.0 e inferiores
Reproducir Sonidos Del Sistema
(1/1)
tiquinho:
Buenas a tod@s :hola:
Me gustaría incluir en mi programa llamadas a los sonidos asociados de Windows, esos como el que se escucha cuando abres un menú, o cuando te salta un error... que puedes modificar en el panel de control.
No sé si tengo que buscarlos en el registro y abrirlos aparte o existe alguna función o API para que suenen. Alguien sabe del tema??
Gracias por anticipado :D
ebolo:
Debes de usar esta api.
La ruta donde están los sonidos de windows es en C:\windows\Media
-----------------------------------------------------------------------------------------
'Ejecuta un fichero Wav, por el dispositivo de sonido (tarjeta de sonido).
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
Const SND_SYNC = &H0 'just after the sound is ended exit function
Const SND_ASYNC = &H1 'just after the beginning of the sound exit function
Const SND_NODEFAULT = &H2 'if the sound cannot be found no error message
Const SND_LOOP = &H8 'repeat the sound until the function is called again
Const SND_NOSTOP = &H10 'if currently a sound is played the function will return without playing the selected sound
Const Flags& = SND_ASYNC Or SND_NODEFAULT
Private Sub Form_Load()
Dim FicheroSonido As String
FicheroSonido = "C:\WINDOWS\Media\Apagado de Windows XP.wav"
sndPlaySound FicheroSonido, Flags
End Sub
-----------------------------------------------------------------------------------------
Saludos y suerte.
tiquinho:
Gracias por la respuesta ebolo, pero no era eso lo que buscaba. Lo que pretendía creo que lo puedo hacer con la Api
--- Código: Text ---Declare Function MessageBeep Lib "user32" Alias "MessageBeep" (ByVal wType As Long) As Long Y cuyo parámetro puede tomar como valor :
--- Código: Text ---· uTypeSpecifies the sound type, as identified by an entry in the [sounds] section of the registry. This parameter can be one of the following values:0xFFFFFFFF Standard beep using the computer speakerMB_ICONASTERISK SystemAsteriskMB_ICONEXCLAMATION SystemExclamationMB_ICONHAND SystemHandMB_ICONQUESTION SystemQuestionMB_OK SystemDefault
...y yo que no me había bajado la AllApiGuide :nosweat:
tiquinho:
Vaya vaya, esto me pasa por las prisas de responder... :brickwall:
Resulta que no tenía ni idea de que valores correspondían a esas constantes... :nosweat:
Bueno, ahí van:
--- Código: Text ---Public Declare Function MessageBeep Lib "user32" _ (ByVal wType As Long) As LongPublic Const MB_ICONASTERISK = &H40&Public Const MB_ICONEXCLAMATION = &H30&Public Const MB_ICONHAND = &H10&Public Const MB_ICONINFORMATION = MB_ICONASTERISKPublic Const MB_ICONMASK = &HF0&Public Const MB_ICONQUESTION = &H20&Public Const MB_ICONSTOP = MB_ICONHAND Por si le vale a alguien más ^_^
Navegación
Ir a la versión completa