Expand|Select|Wrap|Line Numbers
- Private Sub CmdBrowse_Click()
- On Error GoTo error
- With CDlg1
- 'On Cancel do nothing
- .CancelError = True
- .DialogTitle = "Browse For MP3 Files"
- .Filter = "MP3 Files (*.mp3) |*.mp3; |Wave Files (*.wav) |*.wav; |Midi Files (*.mid) |*.mid"
- .ShowOpen
- 'Handle no filename
- If Len(.FileName) = 0 Then Exit Sub
- txtFile.Text = .FileName
- CmdPlay.SetFocus 'Press enter to play
- End With
- error: 'Do nothing
- End Sub
- Private Sub CmdPlay_Click()
- Play
- End Sub
- Private Sub TxtFile_Change()
- Dim Ext As String
- 'Check if there is a string in txtFile
- If txtFile <> "" Then
- 'File extension is the last three letters
- Ext = LCase(Right(txtFile, 4))
- 'If extension is supported enable player buttons
- If Ext = ".mp3" Or Ext = ".wav" Or Ext = ".mid" Then
- CmdPlay.Enabled = True
- CmdPause.Enabled = True
- CmdStop.Enabled = True
- CmdRew.Enabled = True
- CmdFF.Enabled = True
- chkLoop.Value = 1
- End If
- Else
- 'If no file name disable player buttons
- CmdPlay.Enabled = False
- CmdPause.Enabled = False
- CmdStop.Enabled = False
- CmdRew.Enabled = False
- CmdFF.Enabled = False
- chkLoop.Value = 2
- End If
- End Sub