Link to home
Start Free TrialLog in
Avatar of WilimarLynwood
WilimarLynwood

asked on

download progress (threads)

hi there..

i have a function in my Dialog-based MFC app that checks for updates

void CExDlg::CheckForUpdates()
{
      //...
      //pUpdateDlg is the child dialog has the progress bar

      for (int x = 0; x < num_updatedfiles; x++)
      {
            //function that downloads the updated file
            m_Ftp->GetFile(strFile[x], strFile[x], FALSE, ...);
            pUpdateDlg->m_MyProgressBar.SetPos(x); //<==
      }
}

well problem is =\ the progress bar doesn't move (the whole dialog doesn't refresh) so i'm gonna have to use Threads so the progress bar moves after each file download.

i don't know much about how to use um.. anyone got any ideas?

tried using the ones on CodeProject but i guess i'm just a newbie n dunno how to use them =p
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AndyAinscow
         pUpdateDlg->m_MyProgressBar.SetPos(x); //<==
          pUpdateDlg->UpdateWindow();   //force it to redraw
Avatar of WilimarLynwood
WilimarLynwood

ASKER

tried that before, AndyAinscow, didn't work =(

and, not really sure what the DoEvent() function does, AlexFM, but it works GREAT! =p

Thanks both of you =)
DoEvents handles all Windows messages in the queue, including WM_PAINT. This is a reason dialog is redrawn. Without DoEvents messages remain in queue and handled only when function CheckForUpdates exits.
Your right.  I had a look at an older app that had exactly the same probelm with a prgress control.  I forgot I had a fn to do what Alex suggested in it.
ah =) i have many stuff that needed calling this function after, this helps alot!, hehe