home *** CD-ROM | disk | FTP | other *** search
- Type APISoundMasterForm From SampleMasterForm
- Dim Label1 As New Label
- Dim optReville As New OptionButton
- Dim optDestruct As New OptionButton
- Dim optThatsAll As New OptionButton
- Dim SoundFile As String
- Dim btnPlay As New Button
-
- ' METHODS for object: APISoundMasterForm
- Sub optReville_Click()
- SoundFile = "reville.wav"
- End Sub
-
- Sub optDestruct_Click()
- SoundFile = "destruct.wav"
- End Sub
-
- Sub optThatsAll_Click()
- SoundFile = "thatsall.wav"
- End Sub
-
- Sub ResetApplication_Click ()
-
- ' Initialize Sound Demonstration
- optReville.Value = False
- optDestruct.Value = False
- optThatsAll.Value = False
-
- ' Initilize the sound file variable
- SoundFile = ""
-
- End Sub
-
- Sub btnPlay_Click()
- Dim option As long
- Dim result As long
- Dim sound_file As String
-
- ' Display system busy signal
- App.ShowBusySignal
-
- ' Set a variable to be the name of sound file including absolute path
- sound_file = APISoundMasterForm.SoundFile
-
- If sound_file == "" Then
- InfoBox.Message("Warning", "No sound option has been selected.")
- Exit Sub
- Else
- sound_file = SampleDir & sound_file
- End If
-
- ' Play the selected sound file
- result = AudioPlayer.sndPlaySoundA(sound_file, option)
- End Sub
-
- Sub Load()
- ' Restore prerequisite objects that are shared with other
- ' samples, and therefore may already be loaded.
- If FindObject("AudioPlayer") == Nothing Then
- LoadTextObject(SampleDir & "audio.eto")
- End If
-
- End Sub
-
- End Type
-
- Type AudioPlayer
- Dim SND_SYNC As Long
- Dim SND_ASYNC As Long
- Dim SND_NODEFAULT As Long
- Dim SND_MEMORY As Long
- Dim SND_LOOP As Long
- Dim SND_NOSTOP As Long
- Declare Function sndPlaySoundA Lib "Winmm" (ByVal file As String, ByVal opt As Long) As Long
-
-
- ' METHODS for object: AudioPlayer
- Function Play(file As String) As Long
- Play = sndPlaySoundA(file, SND_ASYNC Or SND_NODEFAULT)
- End Function
-
- Function PlaySync(file As String) As Long
- Play = sndPlaySoundA(file, SND_SYNC Or SND_NODEFAULT)
- End Function
-
- End Type
-
- Begin Code
- ' Reconstruction commands for object: APISoundMasterForm
- '
- With APISoundMasterForm
- .Caption := "Windows Sound Demonstration"
- .Move(4425, 1125, 4890, 3795)
- .DefaultButton := APISoundMasterForm.btnPlay
- .SoundFile := ""
- .SampleDir := "W:\bootcamp\basic\apisound\"
- .SampleName := "apisound"
- With .Label1
- .Caption := "1. Click a sound option, then click Play."
- .ForeColor := 13107200
- .ZOrder := 1
- .Move(300, 300, 4050, 300)
- End With 'APISoundMasterForm.Label1
- With .optReville
- .Caption := "It's time to get up..."
- .ZOrder := 2
- .Move(750, 900, 2400, 300)
- .TabStop := True
- .TabGroup := True
- End With 'APISoundMasterForm.optReville
- With .optDestruct
- .Caption := "This disk will self destruct..."
- .ZOrder := 3
- .Move(750, 1350, 3000, 300)
- End With 'APISoundMasterForm.optDestruct
- With .optThatsAll
- .Caption := "That's all..."
- .ZOrder := 4
- .Move(750, 1800, 2250, 300)
- End With 'APISoundMasterForm.optThatsAll
- With .btnPlay
- .Caption := "Play"
- .ZOrder := 5
- .Move(1500, 2400, 1800, 450)
- End With 'APISoundMasterForm.btnPlay
- With .helpfile
- .FileName := "W:\bootcamp\basic\apisound\apisound.hlp"
- End With 'APISoundMasterForm.helpfile
- End With 'APISoundMasterForm
- ' Reconstruction commands for object: AudioPlayer
- '
- With AudioPlayer
- .SND_SYNC := 0
- .SND_ASYNC := 1
- .SND_NODEFAULT := 2
- .SND_MEMORY := 4
- .SND_LOOP := 8
- .SND_NOSTOP := 16
- End With 'AudioPlayer
- End Code
-