//all globals. They don't change so there's no need to keep recopying them
int x1. int y1, int x2, int y2;
int progress_length = x2 - x1;
RECT rect;
rect.left = x1; = y1;
rect.bottom = y2;

void Progress_bar(int Download_percentage ){
     rect.right = x1 + progress_length * Download_percentage;  //assuming Download_percentage is a fraction
     HDC hdc = GetDC (hwnd_your_progress_bar);
     HBRUSH brush = GetSysColorBrush (COLOR_HIGHLIGHT);  //gray
     FillRect (hdc, rect, brush);
But once again, this is only if you're programming in Windows.

BTW, you can call COM objects (which is what IProgressDialog is) from any language, including C. See here (end of part 2)