Resumen Ver si un sonido se esta ejecutando

El fin de semana alguien preguntaba varias cuestiones, entre ellas como ver si un WAV habia terminado de ejecutarse.

En un programa VB de 16 bits viejo, uso:

Function SoundPlaying() As Integer
    Dim r As Integer
    r = sndStopSound(0, SND_NONSTOP)
    If r = 0 Then
        SoundPlaying = 1
    Else
        SoundPlaying = 0
    End If
End Function

donde tengo declaradas:

' ----- sndPlay stuff -----
Global Const SND_SYNC = &H0 ' Don't return until sound ends (default)
Global Const SND_ASYNC = &H1 ' Return immediately
Global Const SND_NODEFAULT = &H2 ' If the file is not found, do not play default sound
Global Const SND_MEMORY = &H4 ' Play sound from a buffer in memory
Global Const SND_LOOP = &H8 ' Loop sound continously (used with SND_ASYNC)
Global Const SND_NONSTOP = &H10 ' Don't stop this sound to play another one

' ----- .Wav Play Windows Library Function Declaration -----
Declare Function sndPlaySound Lib "MMSYSTEM.DLL" (ByVal SoundFileName As String, ByVal Flags As Integer) As Integer
Declare Function sndStopSound Lib "MMSYSTEM.DLL" Alias "sndPlaySound" (ByVal ANull As Long, ByVal Flags As Integer) As Integer

ATENCION: Hay que modificar las declaraciones para 32 bits..... ver el visor de la API....

Observar el truco de declarar de dos formas a sndPlaySound, en la segunda declaracion, se necesita un primer parametro = 0

Angel "Java" Lopez
ajlopez@ajlopez.com



Resumen Resumen

Visual Basic Página de Visual Basic

Página principal Página principal

www.jrubi.com