Using Progress Bars

To create a Progress Bar, the first function we'll need is GI_WidgetProgressCreate. Prototype seen below:

HANDLE GI_WidgetProgressCreate          (
                HANDLE           parent,
                char *           name,
                int              x,
                int              y,
                int              width,
                int              height,
                int              style
        )

Parameters:

The next function you should take a look at is GI_WidgetProgressSetMax. This function will set the maximum value for a specified progress bar. Hence, setting the max value to 100 if the progress bar will be displaying a percentage.

int GI_WidgetProgressSetMax (
             HANDLE hWnd,
             int    value
	)

Parameters are self-explanatory: HANDLE of the Progress Bar for which to set a max value and then the max value itself.

To actually be able to do anything with a progress bar, we'll need to be able to manipulate its value. This is where GI_WidgetProgressSet comes in.

int GI_WidgetProgressSet (
             HANDLE hWnd,
             int    value
	)

Again, parameters need no explanation.

There are only two more functions dealing with progress bars. GI_WidgetProgressForceRedraw is one of them.

int GI_WidgetProgressForceRedraw (HANDLE hWnd)

I haven't run into a situation where I needed to force a progress bar redraw, but it's good to remember that a function does exist, if the need arises.

The last function, GI_WidgetProgressSetColor, doesn't seem to work. It might be the default style that prevents it from working ("think: button height always 20"). If anyone has anymore insight into this subject, please tell me. Regardless, here's its prototype:

int GI_WidgetProgressSetColor(
             HANDLE hWnd,
             COLOR  color
	)

Related Code: progress_bars.c.