veronesi Posted October 23, 2012 Posted October 23, 2012 Hi allI have the commission to create a small program in AutoIt.Among other things, this script should be able to run movies in a GUI.This is not a problem. I decided to take the ActiveX Object from the Windows Media Player to play movies in my GUI. This because the Media Player is installed on all of our computers.My short test-script (see below) is working nearly perfect, but I can't resize the movie during playing!How can I achieve that I can resize the GUI during running the movie and the movie is also resizing?GUICtrlSetResizing doesn't helpDeleting the ActiveX Object and the WMPlayer.ocx Object in the _Resize Function and recreate it with the new size doesn't work! (Why? Is this a bug?)I didn't found any properties to set the width or height! (http://msdn.microsoft.com/en-us/library/dd563945(v=vs.85).aspx)How can I do this?Or can I embed the Media Player in an other way, to use this functionality?expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Global $hGUI1, $oWMP1, $hWMP1, $sURL $sURL = FileOpenDialog("Please choose a movie", @HomeDrive, "Movies (*.mpg;*.mpeg;*.mp4; *.avi)", 1) If @error Or Not $sURL Then _Exit() $hGUI1 = GUICreate("Test", 300, 200, -1, -1, $WS_SIZEBOX) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_RESIZED, "_Resize") GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $oWMP1 = ObjCreate("WMPlayer.OCX") If Not IsObj($oWMP1) Then Exit $hWMP1 = GUICtrlCreateObj($oWMP1, 0, 0, 300, 200) GUICtrlSetResizing($hWMP1, $GUI_DOCKBORDERS) With $oWMP1 .URL = $sURL Local $iEmergencyTimer = TimerInit() While .playState() = 9 ;Wait while playState = Transitioning (Preparing new media item) If TimerDiff($iEmergencyTimer) > 2000 Then ExitLoop Sleep(50) WEnd .settings.autoStart = False .controls.stop() ;Stop, to ensure, that they are at the beginning! .fullscreen = False .stretchToFit = True .settings.setMode('loop', True) .settings.playCount = 1000000 .settings.rate = 1 .uiMode = 'none' .settings.volume = 100 .settings.mute = False .enableContextMenu = True .controls.play() EndWith While True Sleep(10) WEnd Exit Func _Resize() Local $aSize = WinGetPos($hGUI1) ConsoleWrite("Resize: " & GUICtrlSetPos($hWMP1, 0, 0, $aSize[2], $aSize[3]) & @CRLF) EndFunc ;==>_Resize Func _Exit() Exit EndFunc ;==>_ExitMany thanks, Veronesi
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now