Visual Basic 中学校 掲示板 投稿の管理
タグのない投稿を抽出
統計
RSS
Visual Basic 中学校
投稿一覧
音楽について
この投稿へのリンク
https://keijiban.umayadia.com/ThreadDetail.aspx?ThreadId=9699#CommentId15226
この投稿の削除
削除パスワード
削除する
コメント本文
投稿者
kane
 (中学生)
投稿日時
2010/7/18 22:26:35
すいませんできません(泣
この部分にエラーみたいなのが出ます
Dim WithEvents Button1 As New Button
Dim WithEvents TrackBar1 As New TrackBar
Dim WithEvents Timer1 As New Timer
全部コード貼りますのでコードを作ってもらえませんか?
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
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
Declare Function sndPlaySound _
Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Public Const SND_SYNC = &H0
Public Const SND_ASYNC = &H1
Public Const SND_NODEFAULT = &H2
Public Const SND_MEMORY = &H4
Public Const SND_LOOP = &H8
Public Const SND_NOSTOP = &H10
Dim FilePath = FileName
Dim FolderName As String
Private aliasName = gg
Dim FileName As String
Private strFolder As String = " "
Private strFileName As String = ""
Dim gg As String
Dim ff As String
Dim aa As String
Dim fm As String
Dim cmd As String
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'再生・再開
Call mciSendString(String.Format("open ""{0}"" alias MySound", FileName), "", 0, 0)
Call mciSendString("play MySound", "", 0, 0)
Call mciSendString("play """ & FileName & """", "", 0, 0)
Label1.Text = FileName & "を再生中"
Button2.Text = "再生"
Call mciSendString("play """ & FileName & """", "", 0, 0)
Label1.Text = FileName & "を再生中"
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
'停止
Call mciSendString("Close """ & FileName & """", "", 0, 0)
Me.Label1.Text = FileName & "を停止しました"
Call mciSendString("stop MySound", "", 0, 0)
Call mciSendString("close MySound", "", 0, 0)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'ファイルを開く
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.Cancel Then Exit Sub
FileName = OpenFileDialog1.FileName
'フォルダ名とファイル名に分けるには
gg = System.IO.Path.GetDirectoryName(FileName) 'ここと
ff = System.IO.Path.GetFileName(FileName) 'ここの()
Select Case IO.Path.GetExtension(FilePath)
Case ".mp3", ".wmv", ".mp4"
Case Else
MessageBox.Show(FileName & "が開かれました")
End Select
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
'閉じるイベント
Call mciSendString("Close """ & FileName & """", "", 0, 0)
Me.Close()
End Sub
End Class
お願いします。。