# 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 : Created with UDF

    #include "Extras\WM_NOTIFY.au3"

    #include <GuiAVI.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsNotifsConstants.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("AVI Create (v" & @AutoItVersion & ")", 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 = $lParam
        Local $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word
        Local $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
                        _WM_NOTIFY_DebugInfo("$ACN_START", "hWndFrom,IDFrom", $hWndFrom, $iIDFrom)
                        ; no return value
                    Case $ACN_STOP ; Notifies the parent window of an animation control that the associated AVI clip has stopped playing
                        _WM_NOTIFY_DebugInfo("$ACN_STOP", "hWndFrom,IDFrom", $hWndFrom, $iIDFrom)
                        ; no return value
                EndSwitch
        EndSwitch
        Return $GUI_RUNDEFMSG
    EndFunc   ;==>WM_COMMAND

### Example 2 : Created with UDF

    #include "Extras\WM_NOTIFY.au3"

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

    Global $g_hAVI

    Example()

    Func Example()
        Local $hGUI

        ; Create GUI
        $hGUI = GUICreate("AVI Create (v" & @AutoItVersion & ")", 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 = $lParam
        Local $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word
        Local $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
                        _WM_NOTIFY_DebugInfo("$ACN_START", "hWndFrom,IDFrom", $hWndFrom, $iIDFrom)
                        ; no return value
                    Case $ACN_STOP ; Notifies the parent window of an animation control that the associated AVI clip has stopped playing
                        _WM_NOTIFY_DebugInfo("$ACN_STOP", "hWndFrom,IDFrom", $hWndFrom, $iIDFrom)
                        ; no return value
                EndSwitch
        EndSwitch
        Return $GUI_RUNDEFMSG
    EndFunc   ;==>WM_COMMAND