Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
Const SND_NODEFAULT = &H2
Const SND_SYNC = &H0
Dim Wavfile As String
Private Sub cmd_exit_Click()
End
End Sub
Private Sub cmd_file_Click()
On Error GoTo ErrHandler
' Set CancelError is True
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
' Set flags
CommonDialog1.Flags = cdlOFNHideReadOnly
' Set filters
CommonDialog1.Filter = "All Files (*.*)|*.*|WAV Files" & _
"(*.Wav)|*.Wav"
' Specify default filter
CommonDialog1.FilterIndex = 2
' Display the Open dialog box
CommonDialog1.ShowOpen
' Display name of selected file
Wavfile = CommonDialog1.FileName
Exit Sub
ErrHandler:
MsgBox Error$
Resume Next
Exit Sub
End Sub
Private Sub cmd_play_Click()
Dim rtn As Integer
'/ 지정한 사운드 화일을 재생시키고 제어를 넘긴다.
rtn = PlaySound(Wavfile, 0&, SND_FILENAME Or SND_ASYNC Or SND_NODEFAULT)
If rtn = 0 Then
MsgBox Wavfile & "을 실행할 수 없습니다.", 48, "실행불가"
End If
End Sub
Private Sub cmd_play1_Click()
Dim rtn As Integer
'/ 지정한 사운드 화일을 재생시키고 재생 종료시 까지 제어를 갖고있는다.
rtn = PlaySound(Wavfile, 0&, SND_FILENAME Or SND_SYNC Or SND_NODEFAULT)
If rtn = 0 Then
MsgBox Wavfile & "을 실행할 수 없습니다.", 48, "실행불가"
End If
End Sub
Private Sub cmd_stop_Click()
Dim rtn As Integer
rtn = PlaySound(vbNullString, 0&, SND_FURGE)
If rtn = 0 Then
MsgBox Wavfile & "을 정지할 수 없습니다.", 48, "정지불가"
End If
End Sub
Private Sub Form_Load()
End Sub