Option Explicit
Private Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, _
ByVal lpstrReturnString As String, ByVal uReturnLength _
As Long, ByVal hwndCallback As Long) As Long
Private Declare Function PlaySound Lib "winmm.dll" Alias _
"sndPlaySoundA" (ByVal lpszSoundName As String, ByVal _
uFlags As Long) As Long
Dim sRetString As String
Dim lCallBack As Long
'Start Bedienfeld Sound
Private Sub Command1_Click()
'Dim Path As Integer
'If Option1 = True Then Path = "C:\Sound\Play1\Play1_2.wav"
'If Option2 = True Then Path = "C:\Sound\Play2\Play2_2.wav"
'If Option3 = True Then Path = "C:\Sound\Play3\Play3_2.wav"
'If Option4 = True Then Path = "C:\Sound\Play4\Play4_2.wav"
'If Option5 = True Then Path = "C:\Sound\Play5\Play5_2.wav"
'If Option6 = True Then Path = "C:\Sound\Play6\Play6_2.wav"
'If Option7 = True Then Path = "C:\Sound\Play7\Play7_2.wav"
'If Option8 = True Then Path = "C:\Sound\Play8\Play8_2.wav"
Dim sPath As String
sPath = cboFileSelect.List(cboFileSelect.ListIndex)
If (Dir$(sPath, vbNormal) <> vbNullString) Then
Call Kill(sPath)
End If
sRetString = Space$(128)
Call mciSendString("open new type waveaudio alias capture", _
sRetString, 128, lCallBack)
Call mciSendString("record capture", sRetString, 128, lCallBack)
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = False
End Sub
Private Sub Command2_Click()
If (Command2.Caption = "Pause") Then
Call mciSendString("pause capture", sRetString, 128, lCallBack)
Command2.Caption = "Weiter"
Command1.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Else
Call mciSendString("record capture", sRetString, 128, lCallBack)
Command2.Caption = "Pause"
Command1.Enabled = False
Command3.Enabled = True
Command4.Enabled = False
End If
End Sub
Private Sub Command3_Click()
' Dim Path As Integer
' If Option1 = True Then Path = "C:\Sound\Play1\Play1_2.wav"
' If Option2 = True Then Path = "C:\Sound\Play2\Play2_2.wav"
' If Option3 = True Then Path = "C:\Sound\Play3\Play3_2.wav"
' If Option4 = True Then Path = "C:\Sound\Play4\Play4_2.wav"
' If Option5 = True Then Path = "C:\Sound\Play5\Play5_2.wav"
' If Option6 = True Then Path = "C:\Sound\Play6\Play6_2.wav"
' If Option7 = True Then Path = "C:\Sound\Play7\Play7_2.wav"
' If Option8 = True Then Path = "C:\Sound\Play8\Play8_2.wav"
sRetString = Space$(128)
Dim sPath As String
sPath = cboFileSelect.List(cboFileSelect.ListIndex)
Call mciSendString("stop capture", sRetString, 128, lCallBack)
Call mciSendString("save capture " & sPath, sRetString, 128, lCallBack)
Call mciSendString("close capture", sRetString, 128, lCallBack)
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = True
End Sub
Private Sub Command4_Click()
' wie kommst Du darauf, einen String
' in einem Integer zuzuordnen?
'Dim Path As Integer
'If Option1 = True Then Path = "C:\Sound\Play1\Play1_2.wav"
'If Option2 = True Then Path = "C:\Sound\Play2\Play2_2.wav"
'If Option3 = True Then Path = "C:\Sound\Play3\Play3_2.wav"
'If Option4 = True Then Path = "C:\Sound\Play4\Play4_2.wav"
'If Option5 = True Then Path = "C:\Sound\Play5\Play5_2.wav"
'If Option6 = True Then Path = "C:\Sound\Play6\Play6_2.wav"
'If Option7 = True Then Path = "C:\Sound\Play7\Play7_2.wav"
'If Option8 = True Then Path = "C:\Sound\Play8\Play8_2.wav"
Dim sPath As String
sPath = cboFileSelect.List(cboFileSelect.ListIndex)
Call PlaySound(sPath, 0)
Command3.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
End Sub
Private Sub Form_Load()
' hier eventuell noch die Pfadauswahl einbauen,
' dann allerdings nicht im Form_Load
Const FILENAME As String = "C:\Sound\Play*\Play*_2.wav"
Dim i As Long
Dim s As String
For i = 1 To 8
' dateinamen zusammenbauen
' replace esRetStringtetzt * durch i
s = Replace$(FILENAME, "*", CStr(i))
' item eintragen
Call cboFileSelect.AddItem(s)
Next i
End Sub