New project, add a BAS module to join an MCI control, a Command button and a picture box, set the form's scalemode property to Pixels (3)., .Bas file code:
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 () event:
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"
'initialization
dwparam2.dwcallback = mmcontrol1.hwnd
dwparam2.rc.Left = 0
dwparam2.rc.top = 0
dwparam2.rc.right = 0
dwparam2.rc.bottom = 0
'send messages
Retval & = McISendCommand (mmControl1.deviceID, MCI_where,
MCI_ovly_where_source, dwparam2)
If RetVal & <> 0 THEN 'error occurred.
Buffer $ = Space $ (100)
'Get a description of the error:
Retval & = MciGeterRorstring (Retval &, Buffer $, LEN (Buffer $))
MSGBOX TRIM $ (Buffer $), MB_ok MB_ICONSTOP, "Error"
Else
'Change the Picture Box Size:
Picture1.width = dwparam2.rc.right - dwparam2.rc.leftpicture1.Height = dwparam2.rc.bottom - dwparam2.rc.top
'play movie
MMControl1.wait = true 'Wait for the next command to Complate
MmControl1.command = "Play" 'Play The Video CLIP
MMControl1.command = "close"
END IF
End Sub
Press F5 to run the program