Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Animation Control in MFC

Animation Control in MFC

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialc++
13 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Dhiraj kumar Saini

    Hi, I want to show the progress bar as animation. Can any one give me an example to show how to use CAnimationCtrl Thanks

    _ Offline
    _ Offline
    _AnsHUMAN_
    wrote on last edited by
    #3

    Example[^]

    Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

    1 Reply Last reply
    0
    • K kingori

      this is the easiest control ever use, just add an animate control on a dialog box, add a variable of type CAnimateCtrl. in the OnInitDialog() function call the function Open() and Play(). remember to call function Close() in ua dlg box's OnClose() function or onDestroy() like this. ////////////////////////// m_ctlMyAnimation.Open(_T("C:\\Windows\System32\\migwiz\\progress.avi")); m_ctlMyAnimation.Play(); //////////////////////// remember that this avi shud be some of those simple animation files, not music video or moviz, a good example is that microsoft dog that shows up when yu are searching. ::OnButtonStop() { m_ctlMyAnimation.Stop(); } ::OnClose() { m_ctlMyAnimation.Close(); }

      D Offline
      D Offline
      Dhiraj kumar Saini
      wrote on last edited by
      #4

      Hi, I have used the following code m_avi.Open(IDR_AVI1); m_avi.Play(0,-1,-1); but its giving debug assert at open function whats the problem

      I _ 2 Replies Last reply
      0
      • D Dhiraj kumar Saini

        Hi, I have used the following code m_avi.Open(IDR_AVI1); m_avi.Play(0,-1,-1); but its giving debug assert at open function whats the problem

        I Offline
        I Offline
        Iain Clarke Warrior Programmer
        wrote on last edited by
        #5

        Dhiraj kumar Saini wrote:

        whats the problem

        Find out for yourself what the problem is - use the debugger to find out what assert is being called. Alternatively, put a break point in your code and use the Step Into debug option to follow through the MFC code. Have you tried having the avi as a file, and using Open ("myfile.avi")? Does that work? I suspect you'll either not have the avi properly embedded as a resource, or IDR_AVI1 means different things in different places (it is only defined in resource.h?), or maybe as the wrong resource type. Good luck, Iain.

        1 Reply Last reply
        0
        • D Dhiraj kumar Saini

          Hi, I have used the following code m_avi.Open(IDR_AVI1); m_avi.Play(0,-1,-1); but its giving debug assert at open function whats the problem

          _ Offline
          _ Offline
          _AnsHUMAN_
          wrote on last edited by
          #6

          how/where is IDR_AVI1 defined? Does it contain a valid path for the AVI File

          Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

          D 1 Reply Last reply
          0
          • _ _AnsHUMAN_

            how/where is IDR_AVI1 defined? Does it contain a valid path for the AVI File

            Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

            D Offline
            D Offline
            Dhiraj kumar Saini
            wrote on last edited by
            #7

            The problem is resolved but now i am having a new problem I having a CMainDlg class for Parent dialog on which i am painting CVisitorDlg as a child dialog. I have used CAnimateCtrl in CMainDlg which I want to show when a user clicks a button on CMainDlg. But during clicking this button the CVisitorDlg dialog (Child Dialog is being repainted as it is fetching data from server. But the CAnimateCtrl is showing the animated images after the child dialog is repainted and not during fetching the data. Please tell what to do.

            I _ 3 Replies Last reply
            0
            • D Dhiraj kumar Saini

              The problem is resolved but now i am having a new problem I having a CMainDlg class for Parent dialog on which i am painting CVisitorDlg as a child dialog. I have used CAnimateCtrl in CMainDlg which I want to show when a user clicks a button on CMainDlg. But during clicking this button the CVisitorDlg dialog (Child Dialog is being repainted as it is fetching data from server. But the CAnimateCtrl is showing the animated images after the child dialog is repainted and not during fetching the data. Please tell what to do.

              I Offline
              I Offline
              Iain Clarke Warrior Programmer
              wrote on last edited by
              #8

              Dhiraj kumar Saini wrote:

              Please tell what to do.

              1/ Go on, tell us the solution! I'd like to know if one of my 4 guesses was right. 2/ If it is a new problem, then post a new question - you'll get more people reading it. Iain.

              1 Reply Last reply
              0
              • D Dhiraj kumar Saini

                The problem is resolved but now i am having a new problem I having a CMainDlg class for Parent dialog on which i am painting CVisitorDlg as a child dialog. I have used CAnimateCtrl in CMainDlg which I want to show when a user clicks a button on CMainDlg. But during clicking this button the CVisitorDlg dialog (Child Dialog is being repainted as it is fetching data from server. But the CAnimateCtrl is showing the animated images after the child dialog is repainted and not during fetching the data. Please tell what to do.

                _ Offline
                _ Offline
                _AnsHUMAN_
                wrote on last edited by
                #9

                And the reason for the problem getting resolved was....?

                Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

                D 1 Reply Last reply
                0
                • D Dhiraj kumar Saini

                  The problem is resolved but now i am having a new problem I having a CMainDlg class for Parent dialog on which i am painting CVisitorDlg as a child dialog. I have used CAnimateCtrl in CMainDlg which I want to show when a user clicks a button on CMainDlg. But during clicking this button the CVisitorDlg dialog (Child Dialog is being repainted as it is fetching data from server. But the CAnimateCtrl is showing the animated images after the child dialog is repainted and not during fetching the data. Please tell what to do.

                  _ Offline
                  _ Offline
                  _AnsHUMAN_
                  wrote on last edited by
                  #10

                  are you doing all this in your main thread, then in this case it would get blocked in the process of receiving the data from the server. you should create another thread and implement some notification method to inform the UI that the data download is completed.

                  Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

                  D 1 Reply Last reply
                  0
                  • _ _AnsHUMAN_

                    are you doing all this in your main thread, then in this case it would get blocked in the process of receiving the data from the server. you should create another thread and implement some notification method to inform the UI that the data download is completed.

                    Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

                    D Offline
                    D Offline
                    Dhiraj kumar Saini
                    wrote on last edited by
                    #11

                    Yes I am doing it in the main thread. Can u tell how to make a new thread so that it works fine

                    C 1 Reply Last reply
                    0
                    • _ _AnsHUMAN_

                      And the reason for the problem getting resolved was....?

                      Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

                      D Offline
                      D Offline
                      Dhiraj kumar Saini
                      wrote on last edited by
                      #12

                      Actually the avi file was corrupt

                      1 Reply Last reply
                      0
                      • D Dhiraj kumar Saini

                        Yes I am doing it in the main thread. Can u tell how to make a new thread so that it works fine

                        C Offline
                        C Offline
                        Cedric Moonen
                        wrote on last edited by
                        #13

                        Here[^] is an excellent article that I suggest you read. Threads can't be explained in three lines, this is a very deep subject.

                        Cédric Moonen Software developer
                        Charting control [v1.5] OpenGL game tutorial in C++

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups