Public Class Form1
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstyCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label3.Text = "0.0"
Button1.Enabled = False
Button2.Enabled = True
mciSendString("open new Type waveaudio Alias recsound", "", 0, 0)
mciSendString("record recsound", "", 0, 0)
Timer1.Enabled = True
Label1.Text = "កំពុងថតសម្លេង...!"
Label1.Visible = True
Label2.Text = "File Location: "
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button1.Enabled = True
Button2.Enabled = False
Label1.Text = "ការថតថម្លេងបានបញ្ចប់"
SaveFileDialog1.Title = "Save File Audio"
SaveFileDialog1.FileName = ""
SaveFileDialog1.Filter = "File MP3|*.mp3|File Wave|*.wav"
SaveFileDialog1.FilterIndex = 2
SaveFileDialog1.OverwritePrompt = True
SaveFileDialog1.ShowDialog()
mciSendString("save recsound " & SaveFileDialog1.FileName & "", "", 0, 0)
mciSendString("close recsound", "", 0, 0)
Timer1.Enabled = False
MsgBox("File Created: " & SaveFileDialog1.FileName & "", MsgBoxStyle.OkOnly, "Success")
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label3.Text += 0.01
End Sub
Private Sub AxWindowsMediaPlayer1_ClickEvent(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_ClickEvent) Handles AxWindowsMediaPlayer1.ClickEvent
AxWindowsMediaPlayer1.URL = SaveFileDialog1.FileName
AxWindowsMediaPlayer1.Ctlcontrols.play()
Label2.Text += SaveFileDialog1.FileName
Label1.Text = "កំពុងតែចាក់ស្តាប់"
End Sub
End Class
sorry i can't find windowsMedia player . can you tell me
ReplyDeleteit need to add new item inside the VB tools ,
ReplyDelete