# Function Reference

# _GUICtrlAVI_Play

Plays an AVI clip in an animation control

#include <GuiAVI.au3>
_GUICtrlAVI_Play ( $hWnd [, $iFrom = 0 [, $iTo = -1 [, $iRepeat = -1]]] )

## Parameters

$hWnd | Control ID/Handle to the control
$iFrom | [optional] 0-based index of the frame where playing begins. The value must be less than 65,536. A value of 0 means begin with the first frame in the clip.
$iTo | [optional] 0-based index of the frame where playing ends. The value must be less than 65,536. A value of -1 means end with the last frame in the clip.
$iRepeat | [optional] Number of times to replay the AVI clip. A value of -1 means replay the clip indefinitely.

## Return Value

Success: | True.
Failure: | False.

## Remarks

The control plays the clip in the background while the thread continues executing.

## Related

_GUICtrlAVI_Seek, _GUICtrlAVI_Stop

## Example

### Example 1

    ; using AutoIt Function

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

    _Example_Internal()

    Func _Example_Internal()
        Local $idAVI, $idBtn_Start, $idBtn_Stop

        ; Create GUI
        GUICreate("(Internal) AVI Play/Stop", 300, 200)
        $idAVI = GUICtrlCreateAvi(@SystemDir & "\shell32.dll", 160, 10, 10)
        $idBtn_Start = GUICtrlCreateButton("start", 50, 150, 70, 22)
        $idBtn_Stop = GUICtrlCreateButton("stop", 150, 150, 70, 22)
        GUISetState(@SW_SHOW)

        ; Loop until the user exits.
        While 1
            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                    ExitLoop
                Case $idBtn_Start
                    ; Play part of the AVI clip
                    _GUICtrlAVI_Play($idAVI)
                Case $idBtn_Stop
                    ; Stop AVI clip
                    _GUICtrlAVI_Stop($idAVI)
            EndSwitch
        WEnd

        ; Close AVI clip
        _GUICtrlAVI_Close($idAVI)

        GUIDelete()
    EndFunc   ;==>_Example_Internal

### Example 2

    ; using UDF

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

    _Example_External()

    Func _Example_External()
        Local $hGUI, $hAVI, $idBtn_Start, $idBtn_Stop

        ; Create GUI
        $hGUI = GUICreate("(External) AVI Play/Stop", 300, 200)
        $hAVI = _GUICtrlAVI_Create($hGUI, @SystemDir & "\Shell32.dll", 160, 10, 10)
        $idBtn_Start = GUICtrlCreateButton("start", 50, 150, 70, 22)
        $idBtn_Stop = GUICtrlCreateButton("stop", 150, 150, 70, 22)
        GUISetState(@SW_SHOW)

        ; Loop until the user exits.
        While 1
            Switch GUIGetMsg()
                Case $GUI_EVENT_CLOSE
                    ExitLoop
                Case $idBtn_Start
                    ; Play part of the AVI clip
                    _GUICtrlAVI_Play($hAVI)
                Case $idBtn_Stop
                    ; Stop AVI clip
                    _GUICtrlAVI_Stop($hAVI)
            EndSwitch
        WEnd

        ; Close AVI clip
        _GUICtrlAVI_Close($hAVI)

        GUIDelete()
    EndFunc   ;==>_Example_External