AnimationCtrl/VC/AnimationCtrl_Sample/AnimationCtrl_Sample.cpp

// AnimationCtrl ‑ (c)2001 by Louis.
//
// This code was provided for educational purposes, you may
// do with it what you want.
// Use it to play soundless AVI files without any ActiveX control.
// I recommend to add the AnimationCtrl code to an
// existing VC dll that belongs to the target project.

#include "AnimationCtrl_Sample.h"

CAnimateCtrl *AnimationCtrl = new CAnimateCtrl;

// *************************************ANIMATIONCTRL*************************************

long _stdcall AnimationCtrl_Create(long X, long Y, HWND ParentWindowhWnd)
{
    // Windows will size the animation target window automatically

    RECT RECTVar;

    RECTVar.left = X;
    RECTVar.top  = Y;
    RECTVar.right  = X + 1;
    RECTVar.bottom = Y + 1;

    CWnd *ParentWindowCWnd = CWnd::FromHandle( ParentWindowhWnd );

    if (AnimationCtrl‑>Create( WS_CHILD | WS_VISIBLE | ACS_TRANSPARENT, RECTVar, ParentWindowCWnd, 0))
        return 1; // ok
    else
        return 0; // error
}

long _stdcall AnimationCtrl_Open(char *AVIFileName)
{
    // AVIFileName must be null‑terminated

    // reset
    AnimationCtrl‑>Close();

    // begin
    if (AnimationCtrl‑>Open( AVIFileName ))
        return 1; // ok
    else
        return 0; // error
}

long _stdcall AnimationCtrl_Seek(unsigned short FrameNumber)
{
    if (AnimationCtrl‑>Seek( FrameNumber ))
        return 1; // ok
    else
        return 0; // error
}

long _stdcall AnimationCtrl_Play(unsigned short FrameStartIndex, unsigned short FrameEndIndex, unsigned short RepeatNumber)
{
    if (AnimationCtrl‑>Play( FrameStartIndex, FrameEndIndex, RepeatNumber ))
        return 1; // ok
    else
        return 0; // error
}

long _stdcall AnimationCtrl_Stop()
{
    if (AnimationCtrl‑>Stop())
        return 1; // ok
    else
        return 0; // error
}

long _stdcall AnimationCtrl_Destroy()
{
    AnimationCtrl‑>Close(); // do not check return value, just close

    delete AnimationCtrl;   // delete animation control object

    return 1; // ok
}

void _stdcall AnimationCtrl_Move(long X, long Y)
{
    // Note that the AnimationCtrl is sized automatically

    RECT RECTVar;
    LPRECT RECTVarPointer = &RECTVar;

    AnimationCtrl‑>GetClientRect( RECTVarPointer );
    AnimationCtrl‑>MoveWindow(X, Y, RECTVar.right, RECTVar.bottom, TRUE);
}

void _stdcall AnimationCtrl_Show()
{
    ShowWindow( AnimationCtrl‑>m_hWnd, SW_SHOW );
}

void _stdcall AnimationCtrl_Hide()
{
    ShowWindow( AnimationCtrl‑>m_hWnd, SW_HIDE );
}

// *********************************END OF ANIMATIONCTRL**********************************


[END OF FILE]