| 首页 | 新闻 | 网页 | 设计 | 色彩 | 原创 | 视觉 | 素材 | 动漫 | 酷站 | 策划 | 文案 | 访谈 | 运营 | 编程 | 数据库 | 服务器 | 下载 | 图库 | 
您的位置: 幽幽天空 > 网页 > 编程开发 > VB教程 > 文章正文 用户登录
连接SQL SERVER的
一个自动生成用AD
VB访问SQLServer的
在 SQL Server 2K
VB程序中处理随机
VB编程的必备技巧
让VB应用程序支持
VB中Winsock控制的
VB7新特性预览
在VB中使用文件对

vb6中用图片框任意大小播放AVI电影(New)           

vb6中用图片框任意大小播放AVI电影(New)

作者:佚名 来源:csdn 更新:2006-8-25 21:05:35 错误报告 我要投稿
 
  1. 新建工程,增加一个bas模块
  2. 加入一个MCI控件,一个command按钮和一个图片框,设置form的
    ScaleMode property为 Pixels (3).
  3. .BAS 文件代码:
    
    
       Type RECT
    
          Left As Long
    
          Top As Long
    
          Right As Long
    
          Bottom As Long
    
       End Type
    
    
    
       Type MCI_OVLY_RECT_PARMS
    
          dwCallback As Long
    
          rc As RECT
    
       End Type
    
    
    
       Global Const MCI_OVLY_WHERE_SOURCE = &H20000
    
       Global Const MCI_OVLY_WHERE_DESTINATION = &H40000
    
       Global Const MCI_WHERE = &H843
    
    
    
       
    
       Declare Function mciSendCommand Lib "winmm.dll" _
    
          Alias "mciSendCommandA" ( _
    
             ByVal wDeviceID As Long, _
    
             ByVal uMessage As Long, _
    
             ByVal dwParam1 As Long,
    
             dwParam2 As Any) As Long
    
    
    
       Declare Function mciGetErrorString Lib "winmm.dll" _
    
          Alias "mciGetErrorStringA" ( _
    
             ByVal dwError As Long, _
    
             ByVal lpstrBuffer As String, _
    
             ByVal uLength As Long) As Long
    
     


 Command1_Click()事件:



   Sub Command1_Click ()

      Const MB_OK = 0

      Const MB_ICONSTOP = 16



      Dim Retval&, Buffer$

      Dim dwParam2 As MCI_OVLY_RECT_PARMS



      MMControl1.Command = "Close"

      MMControl1.Filename = "WndSurf1.avi"  '
      

      MMControl1.hWndDisplay = Picture1.hWnd



      MMControl1.Command = "Open"



      '初始化
      dwParam2.dwCallback = MMControl1.hWnd

      dwParam2.rc.Left = 0

      dwParam2.rc.Top = 0

      dwParam2.rc.Right = 0

      dwParam2.rc.Bottom = 0



      '发送消息
            Retval& = mciSendCommand(MMControl1.DeviceID, MCI_WHERE,

                MCI_OVLY_WHERE_SOURCE, dwParam2)



      If Retval& <> 0 Then  '错误发生.

         Buffer$ = Space$(100)

         'Get a description of the error:

         Retval& = mciGetErrorString(Retval&, Buffer$, Len(Buffer$))

         MsgBox Trim$(Buffer$), MB_OK + MB_ICONSTOP, "ERROR"

      Else

         '改变picture box大小:

         Picture1.Width = dwParam2.rc.right - dwParam2.rc.left

         Picture1.Height = dwParam2.rc.bottom - dwParam2.rc.top



         '播放电影
         MMControl1.Wait = True ' Wait for the next command to complete

         MMControl1.Command = "play" 'Play the video clip

         MMControl1.Command = "close"

      End If

   End Sub

 



  1. 按f5运行程序
文章录入:skyuu    责任编辑:skyuu 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    发表评论:
    姓名:  评 分: 1分 2分 3分 4分 5分
     
  • 严禁发表危害国家安全、政治、黄色淫秽等内容的评论。
  • 用户需对自己在使用幽幽天空服务过程中的行为承担法律责任。
  • 本站管理员有权保留或删除评论内容。
  • 评论内容只代表机友个人观点,与本网站立场无关。