Progress bar wont show >_<!
i am making an app which when you start it, it displays an intro screen (Splash Screen within the dialog it self)
using the on ShowWindow message,but after that splash is displayed it will display another screen loading all the resources for the app and showing the % in a Progress bar.
If i set up my progress bar and then show it,it displays correctly but when i try to increment it with StepIt,it doesn't want to show the new value (%).
Code:
Code:
void CEveControlDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
//show window and show intro image
this->SetRedraw(TRUE);
m_Intro.ShowWindow(TRUE);
m_Intro.UpdateWindow();
Sleep(3000);
m_Intro.ShowWindow(FALSE);
HBITMAP Loading = (HBITMAP)LoadImage(0,"Loading.bmp",IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
m_Loading.SetBitmap(Loading);
m_Loading.ShowWindow(TRUE);
m_Loading_Prcnt.ShowWindow(TRUE);
m_Loading_Prcnt.SetRange(0,100);
m_Loading_Prcnt.SetStep(20);
m_Loading_Prcnt.StepIt();
//show Loading screen and start loading resources
}
if i set this way
Code:
m_Loading_Prcnt.SetRange(0,100);
m_Loading_Prcnt.SetStep(20);
m_Loading_Prcnt.StepIt();
m_Loading_Prcnt.ShowWindow(TRUE);
it displays the first 20% right but doesn't want to update to 40% when i later call StepIt again after ShowWindow has been called.
and if i do it this way
Code:
m_Loading.ShowWindow(TRUE);
m_Loading_Prcnt.ShowWindow(TRUE);
m_Loading_Prcnt.SetRange(0,100);
m_Loading_Prcnt.SetStep(20);
m_Loading_Prcnt.StepIt();
m_Loading_Prcnt;
it doesn't wan to even show on the screen.
Can any one tell me what am i doing wrong?
Help will be greatly appreciated.
Re: Progress bar wont show >_<!
Please use ShowWindow as designed using SW_SHOW instead of TRUE.
Your second example does exactly what you want. Set a range of 0 - 100 (%). Then, you set the stepsize to 20. Then, you step once (from 0 -> 20%). Then, the function ends, so what is not working? If you call StepIt() twice, the progress bar will be 40 % (however, don't re-initialize the progress bar by setting its range).
Re: Progress bar wont show >_<!
Your code is not pumping messages while performing the lengthy operation of loading resources etc. Unless your code pumps messages, including the all-important WM_PAINT message, you will not be able to see the result of your calls to StepIt().
Lengthy operations are best performed as follows:
- in a separate thread, or
- for MFC apps, in small chunks in the OnIdle() function, or
- in small chunks with calls to PeekMessage/DispatchMessage between each chunk
Mike
Re: Progress bar wont show >_<!
Quote:
Originally Posted by Tischnoetentoet
Please use
ShowWindow as designed using SW_SHOW instead of TRUE.
Your second example does exactly what you want. Set a range of 0 - 100 (%). Then, you set the stepsize to 20. Then, you step once (from 0 -> 20%). Then, the function ends, so what is not working? If you call StepIt() twice, the progress bar will be 40 % (however, don't re-initialize the progress bar by setting its range).
Whats happening is that when the i start my app and the intro finishes to display and the loading screen appears,it wont show up the progress control.
It shows the BG imageControl but doesn't show the progress control,but if i hide the middle of my apps screen,and get it back up it only draws the part that was hided and the part that wan sent still hided.
I need to redraw the screen so the progress bar shows.
here is a screen so u can see what i mean:
This is the loading screen with the progress hided(how it normally loads)
http://i14.photobucket.com/albums/a3...NI/Loading.jpg
this is what i do to hide the app screen so it redraws part of the bar.
http://i14.photobucket.com/albums/a3...gsemihided.jpg
and this is the app with half the bar redrawn after i move it up.
http://i14.photobucket.com/albums/a3...semidrawed.jpg
Hope those images helped in explaining my prob.
Help will be appreciated.