For my progress bar, I wish to change the RGB color from the default green to red. The docs say the following code would work:
// Set the background color to red.
myCtrl.SetBkColor(RGB(255, 0, 0));
So, I tried this with my code in CProgressDlg::OnInitDialog(). This should give it a dark red color.
m_MyProgress.SetRange(0, 10);
m_MyProgress.SetBkColor(RGB(100, 0, 0));
m_MyProgress.SetStep(1);
However, it is still green on execution! Why is this & what am I missing

MFC: Progress Bar's new RGB value isn't updating on execution
Victor2005
SetBkColor sets the background color!
There is a message PBM_SETBARCOLOR you can use.
http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/progbar/messages/pbm_setbarcolor.asp
Seams that it isnot wrapped in the MFC
Maybe you have to call Invalidate after setting the new color.
Andry
I have got the same problem as said above.
Then I tried to use PBM_SETBARCOLOR but it still doesnt effect my progressbar.
I use following code:
COLORREF color1, color2;
m_ProgressGreen.Invalidate(TRUE);
color1 = m_ProgressGreen.SendMessage(PBM_SETBARCOLOR, 0, (LPARAM)RGB(255, 0, 0));
m_ProgressGreen.Invalidate(FALSE);
m_ProgressBlue.Invalidate(TRUE);
color2 = m_ProgressBlue.SendMessage(PBM_SETBARCOLOR, 0, (LPARAM)RGB(0, 0, 255));
m_ProgressBlue.Invalidate(FALSE);
There is no effect, where i use the Invalidate or not! I looked for a solution i some other forums but wasnt very successfully. This problem seems to be very seldom.
I use:
VS C++ 2005 v.8.0.50727.42
MFC -> Dialogbased Application