home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
p
/
ptv3n5.zip
/
VBWAVE.ZIP
/
PLAYFRM.TXT
< prev
next >
Wrap
Text File
|
1992-10-14
|
3KB
|
104 lines
Const SYSTEMSOUND = 0
Const WAVEFILE = 1
Dim CurrentSound As String
Dim CurrentType As Integer
Sub Form_Load ()
OK% = sndPlaySound("SystemStart", SND_SYNC + SND_NODEFAULT)
PlaySnd.SysSoundList.AddItem "SystemAsterisk"
PlaySnd.SysSoundList.AddItem "SystemHand"
PlaySnd.SysSoundList.AddItem "SystemDefault"
PlaySnd.SysSoundList.AddItem "SystemExclamation"
PlaySnd.SysSoundList.AddItem "SystemQuestion"
PlaySnd.SysSoundList.AddItem "SystemExit"
PlaySnd.SysSoundList.AddItem "SystemStart"
End Sub
Sub PlayButton_Click ()
Dim Msg As String, CrLf As String, WaveError As Integer
WaveError = FALSE
CrLf$ = Chr$(13) + Chr$(10)
If CurrentSound$ = "" Then
WaveError = TRUE
Msg$ = "There is no sound selected."
End If
If (CurrentType% = WAVEFILE) And
(Right$(UCase$(CurrentSound$), 3) <> "WAV") Then
WaveError = TRUE
Msg$ = "The current file: " + CurrentSound$ + CrLf$
Msg$ = Msg$ + "is not a valid waveform file." + CrLf$
Msg$ = Msg$ + "Only files with a .WAV extension" + CrLf$
Msg$ = Msg$ + "can be selected."
End If
If Not WaveError Then
Worked% = sndPlaySound(CurrentSound$, SND_SYNC)
End If
If Worked% = FALSE Then
WaveError = TRUE
Msg$ = "Couldn't find the requested .WAV file."
End If
If WaveError Then
MessageBeep (MB_ICONINFORMATION)
MsgBox Msg$, MB_ICONINFORMATION, "sndPlaySound Error"
End If
End Sub
Sub ExitButton_Click ()
OK% = sndPlaySound("SystemExit", SND_SYNC + SND_NODEFAULT)
End
End Sub
Sub WaveFileList_Click ()
CurrentType% = WAVEFILE
CurrentSound$ =
FullPathName$(WaveFileList.Path, WaveFileList.FileName)
lblCurrentSound.Caption = CurrentSound$
End Sub
Function FullPathName$ (ByVal PathName$, ByVal FileName$)
If Right$(PathName$, 1) <> "\" Then
PathName$ = PathName$ + "\"
End If
FullPathName$ = PathName$ + FileName$
End Function
Sub WaveFileList_DblClick ()
CurrentType% = WAVEFILE
CurrentSound$ =
FullPathName$(WaveFileList.Path, WaveFileList.FileName)
lblCurrentSound.Caption = CurrentSound$
PlayButton.Value = TRUE
End Sub
Sub Dir1_Change ()
WaveFileList.Path = Dir1.Path
End Sub
Sub Command1_Click ()
End Sub
Sub SysSoundButton_Click ()
If SysSoundList.ListIndex <> -1 Then
CurrentSound$ = SysSoundList.List(SysSoundList.ListIndex)
End If
End Sub
Sub SysSoundList_Click ()
CurrentType% = SYSTEMSOUND
CurrentSound$ = SysSoundList.List(SysSoundList.ListIndex)
lblCurrentSound.Caption = CurrentSound$
End Sub
Sub SysSoundList_DblClick ()
CurrentType% = SYSTEMSOUND
CurrentSound$ = SysSoundList.List(SysSoundList.ListIndex)
lblCurrentSound.Caption = CurrentSound$
PlayButton.Value = TRUE
End Sub