官网的例子,不知道是不是你要的效果。
#include <Constants.au3>
#include <StructureConstants.au3>
#include <GUIConstants.au3>
Local $hGui = GUICreate("WMPlayer", 400, 300)
Local $oPlayer = ObjCreate("WMPlayer.OCX")
If Not IsObj($oPlayer) Then Exit MsgBox($MB_SYSTEMMODAL, "WMPlayer.OCX", "Cannot create a WMP object.", 5)
GUICtrlCreateObj($oPlayer, 0, 0, 400, 300)
With $oPlayer
.URL = "B:\影视音乐\音乐\哥已不是当年的哥.mp4"
.uiMode = "none"
.settings.mute = False
EndWith
While $oPlayer.playState = 9
Sleep(50)
WEnd
GUISetState()
ResizeOCX($oPlayer, 0, 0, 400, 300)
While $oPlayer.playState = 3
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func ResizeOCX($oObject, $iLeft, $iTop, $iRight, $iBottom)
Local Const $tagIOleInPlaceObj = _
"ContextSensitiveHelp none(int); " & _
"GetWindow none(ptr); " & _
"InPlaceDeactivate none(); " & _
"ReactivateAndUndo none(); " & _
"SetObjectRects none(ptr; ptr;); " & _
"UIDeactivate none();"
Local $oIInPlace = ObjCreateInterface($oObject, "{00000113-0000-0000-C000-000000000046}", $tagIOleInPlaceObj)
Local $tRect = DllStructCreate($tagRECT)
$tRect.Left = $iLeft
$tRect.Top = $iTop
$tRect.Right = $iRight
$tRect.Bottom = $iBottom
Local $pRect = DllStructGetPtr($tRect)
$oIInPlace.SetObjectRects($pRect, $pRect)
EndFunc ;==>ResizeOCX
|