CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  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.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured