Thread: Animation control help

  1. #1
    george7378
    Guest

    Animation control help

    Hi everyone,

    I'm trying to get the hang of Win32 animation controls, which, as I understand, are used to display .avi files in a dialog box. I've used Resedit to create a dialog box and place an animation control in it, and my program runs fine, but now I don't know how to get the animation into the control.

    So, Resedit has created a resource file which looks like this:

    Code:
    #include <windows.h>
    #include <commctrl.h>
    #include <richedit.h>
    #include "resource.h"
    
    
    LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
    IDD_MAIN DIALOG 0, 0, 394, 283
    STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
    CAPTION "Dialog"
    FONT 8, "Ms Shell Dlg"
    BEGIN
        CONTROL         "", IDD_ANIMATION, ANIMATE_CLASS, WS_BORDER, 10, 6, 373, 266
    END
    My question is - where do I define the name/path of the .avi file that I want to put in the control? Is it between the two quote marks at the beginning of the CONTROL?

    Thanks for your help!!

  2. #2
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    639
    You don't. You use Animate_Open() with the file/resource name and the other macros to play/seek/stop etc. Note that there are severe restrictions on what type of AVI it can play. For support for fancier avi's, try the MCIWnd window class instead
    Last edited by adeyblue; 04-04-2012 at 09:07 AM.

  3. #3
    george7378
    Guest
    Oh, I've been looking at that, but I don't know how to use it - when I type this:

    Code:
    Animate_Open(IDD_ANIMATION, "fun.avi");
    ...I get a compiler error saying that:

    'SendMessageA' : cannot convert parameter 1 from 'int' to 'HWND'

    I can see why this might happen (it's designed to take a HWND, after all), but I don't know what to do about it - which HWND should I use, assuming that I load the animation control using a resource file like I did in the first post?

    Thanks!

  4. #4
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    639
    Use GetDlgItem(hwndDlg, IDD_ANIMATION); to get the handle to the animation control, then pass that to the macros.

  5. #5
    george7378
    Guest
    Ah, thanks a lot!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. mfc animation
    By bos1234 in forum Windows Programming
    Replies: 1
    Last Post: 03-18-2011, 04:15 AM
  2. Animation in SDL
    By cboard_member in forum Game Programming
    Replies: 23
    Last Post: 06-06-2006, 05:32 AM
  3. animation in C#
    By luigi40 in forum C# Programming
    Replies: 3
    Last Post: 08-13-2005, 05:28 AM
  4. Using AVI's from dll in animation common control
    By Unregistered in forum Windows Programming
    Replies: 0
    Last Post: 01-16-2002, 01:05 PM
  5. Animation
    By GaPe in forum C Programming
    Replies: 3
    Last Post: 01-01-2002, 09:29 AM