ورود

View Full Version : آموزش: چگونه یک صدا را ضبط و بعد بخش کنیم



www.pc3enter.tk
دوشنبه 19 مرداد 1394, 20:01 عصر
این کدو بدون تغییر داخل برنامه بگذارید و بعد برنامه را اجرا کمی حرف بزنید و بعد کوش کنید و در اخر نمایش حال کنید

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 mciGetErrorString Lib "winmm.dll" _
Alias "mciGetErrorStringA" _
(ByVal dwError As Long, _
ByVal lpstrBuffer As String, _
ByVal uLength As Long) As Long


Sub CloseSound()
Result& = mciSendString("close mysound", ReturnString, 1024, 0)
End Sub
Sub RecordSound()
Result& = mciSendString("open new type waveaudio alias mysound", ReturnString, 1024, 0)
If Not Result& = 0 Then
errormsg% = mciGetErrorString(Result&, ErrorString, 1024)
MsgBox ErrorString, 0, "Error"
Exit Sub
End If
Result& = mciSendString("record mysound to 1300000", ReturnString, 1024, 0)
End Sub
Sub PlayRecSound()
a = mciSendString("play mysound from 1 wait", ReturnString, 1024, 0)
End Sub
Private Sub Form_Load()
RecordSound
End Sub
Private Sub Form_Unload(Cancel As Integer)
Call PlayRecSound
CloseSound
End Sub

اگر خوب باز هم بزارم