Hi all,
Not to encroach on CYCho's zPlayer - I've just gove to upload this and found another example at the top. (looks good by the way!)
Mine is just a proof of concept anyhow.
The main problem here is that when you load a video with the WMP control, there is no obvoius way to scale the video down from its native resoultion.
After a lot of searching I found you can use SetObjectRects fuction on the IOleInPlaceObj interface - but in AutoIt we first need to create this.
$oWMP = ObjCreate("WMPlayer.OCX")
GUICtrlCreateObj($oWMP, 0, 0, 400, 400)
$oIInPlaceObj = _CreateInPlaceObjInterface($oWMP)
$oIInPlaceObj.SetObjectRects($pRect1, $pRect2) ;Resizes the control
Func _CreateInPlaceObjInterface($oObject)
Local $oIInPlaceObj, $tagIOleInPlaceObj
$tagIOleInPlaceObj = _
"ContextSensitiveHelp none(int); " & _
"GetWindow none(ptr); " & _
"InPlaceDeactivate none(); " & _
"ReactivateAndUndo none(); " & _
"SetObjectRects none(ptr; ptr;); " & _
"UIDeactivate none();"
$oIInPlaceObj = ObjCreateInterface($oObject, "{00000113-0000-0000-C000-000000000046}", $tagIOleInPlaceObj)
If Not IsObj($oIInPlaceObj) Then Return SetError(1, False)
Return $oIInPlaceObj
EndFunc
Hope this saves someone a bit of pain!
Just for completeness, it looks like some people have solved the resizing problem by embedding the player in HTML. I haven't really looked at this method but it does seem to work!
Anyway, here's a bare bones build-your-own media player example. (use the WMP_v1.au3 like a UDF)
Function List:
Limitations
onEventMode is forced.
only one instance of the player is supported.
WMP ActiveX Control...
_MP_Create($ix, $iy, $iw, $ih)
_MP_Resize($ix, $iy, $iw, $ih)
load a single media item
_MP_LoadMedia($sPath)
playlist
_MP_PlaylistSelItem($iIndex)
_MP_PlaylistAdd($sPath)
GUI Controls....
_MP_CtrlCreatePlayPause($ix, $iy, $iw, $ih)
_MP_CtrlCreateStop($ix, $iy, $iw, $ih)
_MP_CtrlCreateRewind($ix, $iy, $iw, $ih)
_MP_CtrlCreateFastFwd($ix, $iy, $iw, $ih)
_MP_CtrlCreatePrevious($ix, $iy, $iw, $ih)
_MP_CtrlCreateNext($ix, $iy, $iw, $ih)
_MP_CtrlCreateShuffle($ix, $iy, $iw, $ih)
_MP_CtrlCreateLoop($ix, $iy, $iw, $ih)
_MP_CtrlCreateMute($ix, $iy, $iw, $ih)
_MP_CtrlCreateVolume($ix, $iy, $iw, $ih)
_MP_CtrlCreateFullScreen($ix, $iy, $iw, $ih)
_MP_CtrlCreateTransport($ix, $iy, $iw, $ih)
_MP_CtrlCreatePlayList($ix, $iy, $iw, $ih)
Otherwise just call these...
_MP_PlayPause()
_MP_Stop()
_MP_Rewind()
_MP_FastFwd()
_MP_Previous()
_MP_Next()
_MP_Shuffle()
_MP_Loop()
_MP_Mute()
_MP_FullScreen()
Demo.au3
WMP_v1.au3