中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档 | 网通镜像
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 编程语言 > Visual Basic > 多媒体
--==vb6中用图片框任意大小播放AVI电影(New)==--
作者:coolstar 时间:2001-11-02 10:45 出处:互联网 责编:chinaitpower
              摘要:--==vb6中用图片框任意大小播放AVI电影(New)==--
  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运行程序
关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有