project componentten microsoft common dialog control ü ekleyin
4 command 1 tanede text kutusu ekleyin
olduğu gibi forma yapıştırn
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
Private Sub Command1_Click()
Dim Hata As Long
Dim HataMesaji As String * 128
'Mesajı gönderiyoruz
Hata = mciSendString("open " & Chr$(34) & Text1.Text & Chr$(34) & " alias YeniSes", 0, 0, 0)
'Hata Mesajını Alıyoruz
mciGetErrorString Hata, HataMesaji, 128
MsgBox HataMesaji
End Sub
Private Sub Command2_Click()
mciSendString "play YeniSes", 0, 0, 0
End Sub
Private Sub Command3_Click()
mciSendString "close Yenises", 0, 0, 0
End Sub
Private Sub Command4_Click()
On Error GoTo error
With CommonDialog1
.CancelError = True
.DialogTitle = "Ses Dosyası aç_-_-_-_-Sunasoft Yazılım Bilgisayar-_-_-_-_"
.Filter = "Şarkı Dosyaları (*.mp3) |*.mp3; |Ses Dosyaları (*.wav) |*.wav; |Midi Dosyaları (*.mid) |*.mid"
.InitDir = "c:\"
.ShowOpen
If Len(.FileName) = 0 Then Exit Sub
Text1.Text = .FileName
cmdPlay.SetFocus
End With
error:
End Sub
Private Sub Form_Load()
'''Buraları bilmesenizde olur ben sadece nasıl çalıştığını görün diya yaptım
Left = (Screen.Width - Width) \ 2
Top = (Screen.Height - Height) \ 2
Command1.Caption = "Yükle"
Command2.Caption = "Çal"
Command3.Caption = "Dur"
Command4.Caption = "Gözat"
Form1.Height = 4920
Form1.Width = 8820
Command1.Top = 720
Command1.Left = 480
Command2.Top = 1320
Command2.Left = 480
Command3.Top = 1920
Command3.Left = 480
Command4.Top = 2400
Command4.Left = 6600
Text1.Top = 2520
Text1.Left = 480
Text1.Height = 285
Text1.Width = 6015
End Sub