User Tools

Site Tools


Creating an animation control

by Richard Russell, November 2009

A typical example of an animation control is the familiar 'search' animation:

To create an animation control in your main window use code similar to the following:

        INSTALL @lib$+"WINLIB5A"
        ACM_OPEN = &464
        ACM_PLAY = &465
        WS_BORDER = &800000
        hwndAnim% = FN_createwindow(@hwnd%, "SysAnimate32", "", 100, 100, \
        \                           0, 0, 0, WS_BORDER, 0)
        SYS "SendMessage", hwndAnim%, ACM_OPEN, 0, "C:\windows\search.avi"
        SYS "SendMessage", hwndAnim%, ACM_PLAY, -1, &FFFF0000

Note: the file search.avi probably won't be at that location on your PC.

To create an animation control in a dialogue box use code similar to the following:

        INSTALL @lib$+"WINLIB2"
        ACM_OPEN = &464
        ACM_PLAY = &465
        WS_VISIBLE = &10000000
        IDC_ANIMATE = 1000
        dlg% = FN_newdialog("Animation", 200, 100, 74, 50, 8, 1000)
        PROC_dlgctrl(dlg%, "", IDC_ANIMATE, 10, 10, 0, 0, WS_VISIBLE, "SysAnimate32")
        SYS "SendDlgItemMessage", !dlg%, IDC_ANIMATE, ACM_OPEN, 0, "C:\windows\search.avi"
        SYS "SendDlgItemMessage", !dlg%, IDC_ANIMATE, ACM_PLAY, -1, &FFFF0000

Be aware of the caveat in the relevant MSDN page: “An animation control can display an AVI clip originating from either an uncompressed AVI file or from an AVI file that was compressed using run-length (BI_RLE8) encoding. The AVI file must not have a sound channel. The capabilities of the animation control are very limited and are subject to change”.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
creating_20an_20animation_20control.txt · Last modified: 2018/04/17 15:54 by tbest3112