1、vb多媒体程序代码各窗体代码第一窗体Private Sub form1_load() Label1.Left = Form1.ScaleWidth Label1.ForeColor = RGB(0, 220, 0)End SubPrivate Sub 结束_Click() EndEnd SubPrivate Sub 进入_Click() Unload Me Form2.ShowEnd SubPrivate Sub Timer1_Timer()If Label1.Left + Label1.Width 0 Then Label1.Move Label1.Left - 50Else Label1.
2、Left = Form1.ScaleWidth End IfEnd Sub第二窗体Private Sub flash_Click() Unload Me Form3.ShowEnd SubPrivate Sub Form2_Load()Label1.ForeColor = RGB(0, 200, 0)End SubPrivate Sub Label1_Click()Label1.ForeColor = RGB(0, 200, 0)End SubPrivate Sub mp3_Click() Unload Me Form4.ShowEnd SubPrivate Sub 后退_Click() Un
3、load Me Form1.ShowEnd SubPrivate Sub 结束_Click() EndEnd SubPrivate Sub 视频_Click() Unload Me Form5.ShowEnd Sub第三窗体Option ExplicitPrivate Declare Function SetWindowLong Lib user32 Alias SetWindowLongA (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPrivate Declare Function Ge
4、tWindowLong Lib user32 Alias GetWindowLongA (ByVal hwnd As Long, ByVal nIndex As Long) As LongPrivate Const GWL_STYLE = (-16)Private Const WS_CAPTION = &HC00000Private Const WS_THICKFRAME = &H40000Private Sub cmdnextframe_Click() ShockwaveFlash1.Forward End SubPrivate Sub cmdpause_Click() ShockwaveF
5、lash1.StopEnd SubPrivate Sub cmdplay_Click() Form1.Caption = CommonDialog1.FileName + -flash动画播放器 ShockwaveFlash1.Playing = True Slider1.Max = ShockwaveFlash1.TotalFrames Label2.Caption = Str(Slider1.Max / 2) + 帧 Label3.Caption = Str(Slider1.Max) + 帧 ShockwaveFlash1.Movie = CommonDialog1.FileNameEnd
6、 SubPrivate Sub cmdpreframe_Click() ShockwaveFlash1.back End SubPrivate Sub Command6_Click() Form2.Show Unload MeEnd SubPrivate Sub Command2_Click()List1.ClearEnd SubPrivate Sub List2_Click()ShockwaveFlash1.Movie = List1.ListIndexEnd SubPrivate Sub List2_DblClick()ShockwaveFlash1.Movie = List1.TextE
7、nd SubPrivate Sub form_resize()ShockwaveFlash1.Height = Form1.Height / 2: ShockwaveFlash1.Width = Form1.Width / 2End SubPrivate Sub 打开_Click() On Error GoTo exitopen CommonDialog1.Flags = cdlOFNAllowMultiselect Or cdlOFNFileMustExist Or cdlOFNExplorer CommonDialog1.FileName = CommonDialog1.ShowOpen
8、ShockwaveFlash1.Movie = CommonDialog1.FileName cmdplay_Clickexitopen: List1.AddItem (CommonDialog1.FileName)End SubPrivate Sub 返回_Click() Unload Me Form2.ShowEnd SubPrivate Sub 放大_Click() 放大.Checked = Not 放大.CheckedIf 放大.Checked Then ShockwaveFlash1.Zoom (50) 放大.Caption = 正常Else ShockwaveFlash1.Zoom
9、 (0) 放大.Caption = 放大End IfEnd SubPrivate Sub 后退_Click() Form2.Show Unload MeEnd SubPrivate Sub 连续播放_Click() List1.ListIndex = List1.ListIndex + 1 cmdplay_ClickEnd SubPrivate Sub 全屏播放_Click() Dim ReturnValue As Long, WindowStyle As Long 全屏播放.Checked = Not 全屏播放.Checked If 全屏播放.Checked Then WindowStyle
10、 = GetWindowLong(Me.hwnd, GWL_STYLE) ReturnValue = SetWindowLong(Me.hwnd, GWL_STYLE, WindowStyle - WS_CAPTION - WS_THICKFRAME) Me.WindowState = vbNormal Me.Move 0, 0, Screen.Width, Screen.Height ShockwaveFlash1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight ShockwaveFlash1.play 全屏播放.Caption = 正常 cmdplay.V
11、isible = False cmdpause.Visible = False cmdpreframe.Visible = False cmdnextframe.Visible = False Command2.Visible = False Label1.Visible = False Label2.Visible = False Label3.Visible = False Label4.Visible = False Command6.Visible = False Slider1.Visible = False List1.Visible = False Else 全屏播放.Capti
12、on = 全屏播放 WindowStyle = GetWindowLong(Me.hwnd, GWL_STYLE) ReturnValue = SetWindowLong(Me.hwnd, GWL_STYLE, WindowStyle Or WS_CAPTION Or WS_THICKFRAME) Me.Move 0, 0, 750 * Screen.TwipsPerPixelX, 600 * Screen.TwipsPerPixelY Me.Move (Screen.Width - Me.Width) 2, (Screen.Height - Me.Height) 2 cmdplay.Visi
13、ble = True cmdpause.Visible = True cmdpreframe.Visible = True cmdnextframe.Visible = True Command2.Visible = True Label1.Visible = True Label2.Visible = True Label3.Visible = True Label4.Visible = True Command6.Visible = True Slider1.Visible = True List1.Visible = True End IfEnd SubPrivate Sub 循环播放_
14、Click() ShockwaveFlash1.Rewind ShockwaveFlash1.playEnd SubPrivate Sub Slider1_Scroll()ShockwaveFlash1.FrameNum = Slider1.ValueEnd SubPrivate Sub Timer1_Timer() Form3.Slider1.Value = ShockwaveFlash1.FrameNumEnd Sub第四窗体Option ExplicitPrivate Declare Function SetWindowLong Lib user32 Alias SetWindowLon
15、gA (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPrivate Declare Function GetWindowLong Lib user32 Alias GetWindowLongA (ByVal hwnd As Long, ByVal nIndex As Long) As LongPrivate Const GWL_STYLE = (-16)Private Const WS_CAPTION = &HC00000Private Const WS_THICKFRAME = &H400
16、00Private Sub cmdcontinue_Click() If CommonDialog1.FileName = Then MsgBox 未选择媒体文件, vbOKOnly, 错误消息 Else: WindowsMediaPlayer1.Controls.play End IfEnd SubPrivate Sub cmdnext_Click() On Error GoTo nexterr WindowsMediaPlayer1.Controls.Next Exit Subnexterr:End SubPrivate Sub cmdpause_Click()If CommonDialo
17、g1.FileName = Then MsgBox 未选择媒体文件, vbOKOnly, 错误消息Else: WindowsMediaPlayer1.Controls.pauseEnd IfEnd SubPrivate Sub cmdplay_Click()If CommonDialog1.FileName = Then MsgBox 未选择媒体文件, vbOKOnly, 错误消息 Else WindowsMediaPlayer1.URL = CommonDialog1.FileName WindowsMediaPlayer1.Controls.play Label1.Caption = 现在
18、正在播放: & CommonDialog1.FileName End If Label1.Caption = 现在正在播放: & CommonDialog1.FileNameExit SubEnd SubPrivate Sub cmdstop_Click()If CommonDialog1.FileName = Then MsgBox 未选择媒体文件, vbOKOnly, 错误消息Else: WindowsMediaPlayer1.Controls.Stop cmdplay.Enabled = True cmdpause.Enabled = True cmdcontinue.Enabled =
19、 True cmdstop.Enabled = True End IfEnd SubPrivate Sub Command7_Click() Form2.Show Unload MeEnd SubPrivate Sub Command6_Click()Unload MeForm2.ShowEnd SubPrivate Sub Form_Load() BackColor = RGB(200, 100, 50)End SubPrivate Sub List1_Click() WindowsMediaPlayer1.URL = List1.ListIndexEnd SubPrivate Sub Li
20、st1_DblClick() WindowsMediaPlayer1.URL = List1.TextEnd SubPrivate Sub 打开_Click() CommonDialog1.Filter = MP3 Files(*.mp3)|*.mp3|Wave Files(*.wav)|*.wav CommonDialog1.ShowOpen CommonDialog1.FilterIndex = 1 CommonDialog1.Action = 1 CommonDialog1.Flags = 1 cmdplay_Click If CommonDialog1.FileName = Then
21、MsgBox 未选择媒体文件, vbOKOnly, 错误消息 End If List2.AddItem CommonDialog1.FileName Label1.Caption = 现在正在播放: & CommonDialog1.FileNameEnd SubPrivate Sub 后退_Click() Form2.Show Unload MeEnd SubPrivate Sub 全屏播放_Click() Dim ReturnValue As Long, WindowStyle As Long 全屏播放.Checked = Not 全屏播放.Checked If 全屏播放.Checked T
22、hen WindowStyle = GetWindowLong(Me.hwnd, GWL_STYLE) ReturnValue = SetWindowLong(Me.hwnd, GWL_STYLE, WindowStyle - WS_CAPTION - WS_THICKFRAME) Me.WindowState = vbNormal Me.Move 0, 0, Screen.Width, Screen.Height List2.Visible = False WindowsMediaPlayer1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight 全屏播放.Ca
23、ption = 正常 cmdplay.Visible = False cmdpause.Visible = False Command6.Visible = False cmdcontinue.Visible = False cmdstop.Visible = False Else 全屏播放.Caption = 全屏播放 WindowStyle = GetWindowLong(Me.hwnd, GWL_STYLE) ReturnValue = SetWindowLong(Me.hwnd, GWL_STYLE, WindowStyle Or WS_CAPTION Or WS_THICKFRAME
24、) Me.Move 0, 0, 750 * Screen.TwipsPerPixelX, 600 * Screen.TwipsPerPixelY Me.Move (Screen.Width - Me.Width) 2, (Screen.Height - Me.Height) 2 全屏播放.Caption = 正常 cmdplay.Visible = True cmdpause.Visible = True Command6.Visible = True cmdcontinue.Visible = True cmdstop.Visible = True List2.Visible = True
25、End IfEnd Sub第五窗体Option ExplicitPrivate Declare Function SetWindowLong Lib user32 Alias SetWindowLongA (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongPrivate Declare Function GetWindowLong Lib user32 Alias GetWindowLongA (ByVal hwnd As Long, ByVal nIndex As Long) As LongP
26、rivate Const GWL_STYLE = (-16)Private Const WS_CAPTION = &HC00000Private Const WS_THICKFRAME = &H40000 Private Sub cmdopen_Click() On Error GoTo exitopen CommonDialog1.Flags = cdlOFNAllowMultiselect Or cdlOFNFileMustExist Or cdlOFNExplorer CommonDialog1.FileName = CommonDialog1.ShowOpen MediaPlayer1
27、.FileName = CommonDialog1.FileName cmdplay_Clickexitopen: CommonDialog1.Filter = *.avi CommonDialog1.Action = 1 If CommonDialog1.FileName = Then MsgBox 未选择媒体文件, vbOKOnly, 错误消息 End IfEnd SubPrivate Sub List1_Click() MediaPlayer1.URL = List1.ListIndexEnd SubPrivate Sub List1_DblClick() MediaPlayer1.UR
28、L = List1.TextEnd SubPrivate Sub Command1_Click() Form2.Show Unload MeEnd SubPrivate Sub form3_resize() MediaPlayer1.Height = Form5.Height / 2: MediaPlayer1.Width = Form5.Width / 2End SubPrivate Sub Form_Load() BackColor = RGB(100, 100, 100)End SubPrivate Sub cmdpause_Click() MediaPlayer1.Controls.p
29、auseEnd SubPrivate Sub cmdplay_Click() MediaPlayer1.URL = CommonDialog1.FileName MediaPlayer1.Controls.play cmdpause.Enabled = True Label1.Caption = 现在正在播放: & CommonDialog1.FileNameEnd SubPrivate Sub cmdstop_Click()If CommonDialog1.FileName = Then MsgBox 未选择媒体文件, vbOKOnly, 错误消息Else: MediaPlayer1.Con
30、trols.Stop cmdplay.Enabled = True cmdpause.Enabled = False cmdstop.Enabled = True End IfEnd SubPrivate Sub cmdstep_Click()MediaPlayer1.Controls.fastForwardEnd SubPrivate Sub 打开_Click()On Error GoTo exitopen CommonDialog1.Flags = cdlOFNAllowMultiselect Or cdlOFNFileMustExist Or cdlOFNExplorer CommonDialog1.FileName = CommonDialog1.ShowOpen MediaPlayer1.FileName = CommonDialog1.FileName cmdplay_Clickexitopen: CommonDialog1.Filter = *.avi CommonDialog1.Action = 1
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1