Animated Progress bar not Playing avi file....
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Animated Progress bar not Playing avi file....

  1. #1
    Join Date
    Aug 2008
    Location
    Bangalore India
    Posts
    19

    Exclamation Animated Progress bar not Playing avi file....

    Hi All,

    I have a Modeless dialog which is showing a animated progress bar by playing an avi file(soundless). Actually whenever i am exporting any file i have to display this progress bar as a part of modeless dialog. The problem which i am facing is, just after poping this dialog the avi file is not playing and when i am draging the dialog by a bit, it start playing.
    I tried to get rid of this problem by moving dialog programatticly. I am doing all my programming in win32.
    Here is the part of the code where i am creating the animation.
    Code:
    BOOL CALLBACK CProgressDlg::ProgressDialogProc( HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam )
    {
    	
    	CProgressDlg  *pDlg = NULL;
    	pDlg = (CProgressDlg*)GetWindowLongPtr(hdlg, GWLP_USERDATA);
        switch (message) 
        {
    	case WM_INITDIALOG:
    		{
    			pDlg = (CProgressDlg*)lParam;
    			SetWindowLongPtr(hdlg, GWLP_USERDATA, (LONG_PTR)pDlg);
    			pDlg->m_hWnd = hdlg;
    			CenterWindow(hdlg, NULL);
    			SetWindowText(hdlg, pDlg->m_msg);
    
    			HWND hWndAnimate = GetDlgItem(hdlg, IDC_ANIMATE);
    			HWND hWndMsg = GetDlgItem(hdlg, IDC_STATUS_TEXT1);
    			HWND hProgress = GetDlgItem(hdlg, IDC_PROGRESS);
    			HWND WndProgressAnimate = GetDlgItem(hdlg, IDC_PROGRESS_ANIMATE);
    
    			Animate_Open(hWndAnimate, MAKEINTRESOURCE(IDR_AVI1)); 
    			DoAnimation(hWndAnimate, PLAYIT);
    			SetDlgItemText(hdlg, IDC_STATUS_TEXT1, pDlg->m_msg);
    			HWND hOk = GetDlgItem(hdlg, IDC_OK);
    			ShowWindow(hOk, SW_HIDE);
    			Animate_Open(WndProgressAnimate, MAKEINTRESOURCE(IDR_AVI3));
    			
    			DoAnimation(WndProgressAnimate, PLAYIT);		
    
    			if (pDlg->m_bProgress)
    			{
    				if(!(pDlg->m_bIsHess))
    				{
    					ShowWindow(hProgress, SW_SHOW);
    					ShowWindow(WndProgressAnimate, SW_HIDE);
    				}
    				else
    				{
    					ShowWindow(WndProgressAnimate, SW_SHOW);
    					ShowWindow(hProgress, SW_HIDE);
    				}
    			}
    			else
    			{
    				ShowWindow(hProgress, SW_HIDE);
    				ShowWindow(WndProgressAnimate, SW_HIDE);
    			}
    		}
    		break;
    	case WM_COMMAND:
           switch (LOWORD(wParam))
    		{ 
            case IDC_OK: 
    			PostMessage(hdlg,WM_QUIT,0,0);
    			break;
    		} 
    		break;
        } 
        return FALSE; 
    }
    and DoAnimation is as follows:
    Code:
    void DoAnimation(HWND hwndAnim, int nAction)
    { 
        switch (nAction) { 
            case PLAYIT: 
             // Play the clip continuously starting with the 
             // first frame. 
                Animate_Play(hwndAnim, 0, -1, -1); 
                break; 
    
            case STOPIT: 
                Animate_Stop(hwndAnim); 
                break; 
    
            case CLOSEIT: 
                Animate_Close(hwndAnim); 
                break; 
    
            default: 
                break; 
    
        } 
    
        return; 
    }
    I have attached the avi file. Quick responce are most welcome....
    Attached Files Attached Files
    Last edited by dverma05; March 24th, 2010 at 08:42 AM.

  2. #2
    Join Date
    Feb 2005
    Posts
    2,160

    Re: Animated Progress bar not Playing avi file....

    Please use code tags; it's impossible to follow your code.

    What kind of control is IDC_ANIMATE? How are you updating your dialog?

  3. #3
    Join Date
    Aug 2008
    Location
    Bangalore India
    Posts
    19

    Re: Animated Progress bar not Playing avi file....

    I will explain further....
    See I have an application where we are creating an Explorer Window and showing various folders like private, public, shared. Now each folder contains some files (pdf,jpg,tiff). I can perform cut, copy, delete and export operation on these files. While exporting these files we are displaying a progress bar untill its downloading that particular file to selected location. Since files can be large in size we need to display this progress bar with a message that download process is going on.
    Now the real problem comes here....
    just after starting this progress bar that avi file is not moving untill we drag that progress bar dialog by a bit....

    I have some other controls on that dialog which is one "OK" (ID : IDC_OK)button, one "Cancel" (ID: IDC_CANCEL )button, one Progress bar control (ID: IDC_PROGRESS )and One Animation Bar Control(ID: IDC_PROGRESS_ANIMATE).

    I am calling function StartProgress as follows:
    CProgressDlg dlg(hWnd,szBuffer,bIsHess);

    dlg.StartProgress();
    where
    bool CProgressDlg::StartProgress()
    {
    LOG(CFSLogger::eTRACE, CFSString("Start progress()"));
    bool bReturn = false;

    m_hWnd = CreateDialogParam(g_hInst,
    MAKEINTRESOURCE(IDD_DLG_STATUS),
    m_hWndParent, (DLGPROC)ProgressDialogProc, (LPARAM)this);
    //g_hInst : Global instance variable
    //IDD_DLG_STATUS : Progress dialog id where we have that animation control and other controls.
    //m_hWndParent : handle to parent window
    //ProgressDialogProc : Pointer to the dialog box procedure.
    if (m_hWnd)
    {
    LOG(CFSLogger::eTRACE,
    CFSString("Value returned by CreatedDialogParam() is TRUE"));

    ShowWindow(m_hWnd, SW_SHOW);
    LOG(CFSLogger::eTRACE,
    CFSString("Start Progress returns true"));

    bReturn = true;
    }

    return bReturn;
    }
    ////// to create the progress bar

    /////I have used enum variable

    enum ANIMATE{

    PLAYIT =0,
    STOPIT,
    CLOSEIT
    };

    //inside DoAnimation function.


    I hope things would be clear now....
    Waiting for your response...

  4. #4
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Animated Progress bar not Playing avi file....

    Please use code tags to make your post readable.

    I am doing all my programming in win32.
    Why are you doing it the hard way while you are using MFC ?
    Last edited by Skizmo; November 18th, 2009 at 12:03 AM.

  5. #5
    Join Date
    Aug 2008
    Location
    Bangalore India
    Posts
    19

    Re: Animated Progress bar not Playing avi file....

    Its a running project all the codes has been already written. I have been asked for to fix this defect.
    I am not much more familier with this project. Any way i have to resolve this issue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center