• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • vb6中用圖片框任意大小播放AVI電影

    發表于:2007-07-14來源:作者:點擊數: 標簽:
    新建工程,增加一個bas模塊 加入一個MCI控件,一個command按鈕和一個圖片框,設置form的 ScaleMode property為 Pixels (3). .BAS 文件代碼: Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Type MCI_OVLY_RECT_PARMS dwCallback
    新建工程,增加一個bas模塊
    加入一個MCI控件,一個command按鈕和一個圖片框,設置form的
    ScaleMode property為 Pixels (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

    按f5運行程序

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>