project componentten microsoft common dialog control ü ekleyin
3 command
1 tanede text kutusu ekleyin.
3 command
1 tanede text kutusu ekleyin.
- Kod:
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 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
Label1.Caption = HataMesaji
mciSendString "play YeniSes", 0, 0, 0
End Sub
Private Sub Command2_Click()
mciSendString "close Yenises", 0, 0, 0
End Sub
Private Sub Command3_Click()
On Error GoTo error
With CommonDialog1
.CancelError = True
.DialogTitle = "Ses Dosyası aç"
.Filter = "Şarkı Dosyaları (*.mp3) |*.mp3; |Ses Dosyaları (*.wav) |*.wav; |Midi Dosyaları (*.mid) |*.mid"
.InitDir = Environ("HomeDrive")
.ShowOpen
If Len(.FileName) = 0 Then Exit Sub
Text1.Text = .FileName
Command1.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
Text1.Enabled = False
Left = (Screen.Width - Width) \ 2
Top = (Screen.Height - Height) \ 2
Command1.Caption = "Çal"
Command2.Caption = "Dur"
Command3.Caption = "Gözat"
Form1.Height = 4920
Form1.Width = 8820
Command1.Top = 1320
Command1.Left = 480
Command2.Top = 1920
Command2.Left = 480
Command3.Top = 2400
Command3.Left = 6600
Text1.Top = 2520
Text1.Left = 480
Text1.Height = 285
Text1.Width = 6015
End Sub
Private Sub Form_Unload(Cancel As Integer)
mciSendString "close Yenises", 0, 0, 0
End Sub
Private Sub Text1_Change()
mciSendString "close Yenises", 0, 0, 0
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
Label1.Caption = HataMesaji
mciSendString "play YeniSes", 0, 0, 0
End Sub