我刚做了一个播放器,能播放AVI格式的,现在我想播放DAT格式的!改了一下,不好用,请大家来帮帮忙!
Private Sub Form_Load()MMControl1.DeviceType = "datvideo"
MMControl1.hWndDisplay = Picture1.hWnd
MMControl1.Command = " Open "
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=DAHE-568D57C089;database=歌库;"
db.Open
Dim s As String
With MSFlexGrid1
.Cols = 5
.TextMatrix(0, 1) = "歌曲名"
.TextMatrix(0, 2) = "歌曲编号"
.TextMatrix(0, 3) = "演唱者名"
.TextMatrix(0, 4) = "歌曲路径"
'设置单元大小
.ColWidth(0) = 200
.ColWidth(1) = 1000
.ColWidth(2) = 1000
.ColWidth(3) = 1000
.ColWidth(4) = 1000
End Withrs.Open "select * from shiyong", db, adOpenStatic, adLockReadOnlyWith MSFlexGrid1
.Rows = 1
Do While Not rs.EOF
.Rows = .Rows + 1
For f = 1 To rs.Fields.Count
If Not IsNull(Trim(rs.Fields(f - 1))) Then
.TextMatrix(.Rows - 1, 1) = Trim(rs.Fields("歌曲名"))
.TextMatrix(.Rows - 1, 2) = Trim(rs.Fields("歌曲编号"))
.TextMatrix(.Rows - 1, 3) = Trim(rs.Fields("演唱者名"))
.TextMatrix(.Rows - 1, 4) = Trim(rs.Fields("歌曲路径"))
End If
Next f
rs.MoveNext
Loop
End Withrs.CloseEnd SubPrivate Sub Option1_Click()End SubPrivate Sub Label2_Click()End SubPrivate Sub MSFlexGrid1_Click()
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=DAHE-568D57C089;database=歌库;"
db.Open
Dim intcount As Integer
intcount = MSFlexGrid1.Row
rs.Open "select * from shiyong where 歌曲名 ='" & Trim(MSFlexGrid1.TextMatrix(intcount, 1)) & "'", db, adOpenStatic, adLockReadOnly
CommonDialog1.Filter = " 全部文件(*.*) |*.*| 动画文件 (*.dat),(*.avi),(*.mpeg)|.dat,.avi,.mpeg "
((CommonDialog1.FileName = Text1.Text))
Text1.Text = Trim(rs.Fields("歌曲路径"))
MMControl1.FileName = CommonDialog1.FileName
MMControl1.Command = "open"
MMControl1.UpdateInterval = 100
MMControl1.Command = "play"
CommonDialog1.InitDir = ""
rs.Close
End Sub
CommonDialog1.FileName = Text1.Text 说是这快的错误!
Private Sub Form_Load()MMControl1.DeviceType = "datvideo"
MMControl1.hWndDisplay = Picture1.hWnd
MMControl1.Command = " Open "
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=DAHE-568D57C089;database=歌库;"
db.Open
Dim s As String
With MSFlexGrid1
.Cols = 5
.TextMatrix(0, 1) = "歌曲名"
.TextMatrix(0, 2) = "歌曲编号"
.TextMatrix(0, 3) = "演唱者名"
.TextMatrix(0, 4) = "歌曲路径"
'设置单元大小
.ColWidth(0) = 200
.ColWidth(1) = 1000
.ColWidth(2) = 1000
.ColWidth(3) = 1000
.ColWidth(4) = 1000
End Withrs.Open "select * from shiyong", db, adOpenStatic, adLockReadOnlyWith MSFlexGrid1
.Rows = 1
Do While Not rs.EOF
.Rows = .Rows + 1
For f = 1 To rs.Fields.Count
If Not IsNull(Trim(rs.Fields(f - 1))) Then
.TextMatrix(.Rows - 1, 1) = Trim(rs.Fields("歌曲名"))
.TextMatrix(.Rows - 1, 2) = Trim(rs.Fields("歌曲编号"))
.TextMatrix(.Rows - 1, 3) = Trim(rs.Fields("演唱者名"))
.TextMatrix(.Rows - 1, 4) = Trim(rs.Fields("歌曲路径"))
End If
Next f
rs.MoveNext
Loop
End Withrs.CloseEnd SubPrivate Sub Option1_Click()End SubPrivate Sub Label2_Click()End SubPrivate Sub MSFlexGrid1_Click()
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=DAHE-568D57C089;database=歌库;"
db.Open
Dim intcount As Integer
intcount = MSFlexGrid1.Row
rs.Open "select * from shiyong where 歌曲名 ='" & Trim(MSFlexGrid1.TextMatrix(intcount, 1)) & "'", db, adOpenStatic, adLockReadOnly
CommonDialog1.Filter = " 全部文件(*.*) |*.*| 动画文件 (*.dat),(*.avi),(*.mpeg)|.dat,.avi,.mpeg "
((CommonDialog1.FileName = Text1.Text))
Text1.Text = Trim(rs.Fields("歌曲路径"))
MMControl1.FileName = CommonDialog1.FileName
MMControl1.Command = "open"
MMControl1.UpdateInterval = 100
MMControl1.Command = "play"
CommonDialog1.InitDir = ""
rs.Close
End Sub
CommonDialog1.FileName = Text1.Text 说是这快的错误!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货