Function Reference


_GUICtrlAVI_Create

Creates an AVI control

#include <GuiAVI.au3>
_GUICtrlAVI_Create ( $hWnd [, $sFilePath = "" [, $iSubFileID = -1 [, $iX = 0 [, $iY = 0 [, $iWidth = 0 [, $iHeight = 0 [, $iStyle = 0x00000006 [, $iExStyle = 0x00000000]]]]]]]] )

Parameters

$hWnd Handle to parent or owner window
$sFilePath [optional] The filename of the video. Only .avi files are supported
$iSubFileID [optional] id of the subfile to be used.
$iX [optional] Horizontal position of the control
$iY [optional] Vertical position of the control
$iWidth [optional] Control width
$iHeight [optional] Control height
$iStyle [optional] Control styles:
    $ACS_CENTER - Centers the animation in the animation control's window
    $ACS_TRANSPARENT - Creates the control with a transparent background
    $ACS_AUTOPLAY - Starts playing the animation as soon as the AVI clip is opened
    $ACS_TIMER - The control plays the clip without creating a thread
Default: $ACS_TRANSPARENT, $ACS_AUTOPLAY
Forced: $WS_CHILD, $WS_VISIBLE
$iExStyle [optional] Control extended style. These correspond to the standard $WS_EX_* constants. See Extended Style Table.

Return Value

Success: the handle of the animation control.
Failure: 0.

Remarks

This function is for Advanced users and for learning how the control works.

Related

_GUICtrlAVI_Destroy

Example

Example 1

#include <GuiAVI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $g_hAVI

Example()

Func Example()
    Local $sWow64 = ""
    If @AutoItX64 Then $sWow64 = "\Wow6432Node"
    Local $hGUI, $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\SampleAVI.avi"

    ; Create GUI
    $hGUI = GUICreate("(External 1) AVI Create", 300, 100)
    $g_hAVI = _GUICtrlAVI_Create($hGUI, $sFile, -1, 10, 10)
    GUISetState(@SW_SHOW)

    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

    ; Play the sample AutoIt AVI
    _GUICtrlAVI_Play($g_hAVI)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Close AVI clip
    _GUICtrlAVI_Close($g_hAVI)

    GUIDelete()
EndFunc   ;==>Example

Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode
    $hWndFrom = $lParam
    $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word
    $iCode = BitShift($wParam, 16) ; Hi Word
    Switch $hWndFrom
        Case $g_hAVI
            Switch $iCode
                Case $ACN_START ; Notifies an animation control's parent window that the associated AVI clip has started playing
                    _DebugPrint("$ACN_START" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode)
                    ; no return value
                Case $ACN_STOP ; Notifies the parent window of an animation control that the associated AVI clip has stopped playing
                    _DebugPrint("$ACN_STOP" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode)
                    ; no return value
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @CRLF & _
            "+======================================================" & @CRLF & _
            "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _
            "+======================================================" & @CRLF)
EndFunc   ;==>_DebugPrint

Example 2

#include <GuiAVI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $g_hAVI

Example()

Func Example()
    Local $hGUI

    ; Create GUI
    $hGUI = GUICreate("(External 2) AVI Create", 300, 100)
    $g_hAVI = _GUICtrlAVI_Create($hGUI, @SystemDir & "\Shell32.dll", 150, 10, 10)
    GUISetState(@SW_SHOW)

    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

    ; Play the sample AutoIt AVI
    _GUICtrlAVI_Play($g_hAVI)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Close AVI clip
    _GUICtrlAVI_Close($g_hAVI)

    GUIDelete()
EndFunc   ;==>Example

Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode
    $hWndFrom = $lParam
    $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word
    $iCode = BitShift($wParam, 16) ; Hi Word
    Switch $hWndFrom
        Case $g_hAVI
            Switch $iCode
                Case $ACN_START ; Notifies an animation control's parent window that the associated AVI clip has started playing
                    _DebugPrint("$ACN_START" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode)
                    ; no return value
                Case $ACN_STOP ; Notifies the parent window of an animation control that the associated AVI clip has stopped playing
                    _DebugPrint("$ACN_STOP" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _
                            "-->Code:" & @TAB & $iCode)
                    ; no return value
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @CRLF & _
            "+======================================================" & @CRLF & _
            "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _
            "+======================================================" & @CRLF)
EndFunc   ;==>_DebugPrint