Register a Status Bar Callback
ImageGear function IG_status_bar_CB_register() registers a callback function that will thereafter automatically be called by many ImageGear functions at the end of processing each raster line. The arguments let your callback function compute the completed percentage, so you can maintain and update a status bar or a message box showing this information.
Most of the following ImageGear functions will automatically call (not "register") a status bar callback function if you've registered it:
- IG_load_ ...()
- IG_save_ ...()
- IG_dspl_ ...()
- IG_IP_ ...()
- IG_FX_ ...()
To register your own status bar callback function (and the area you use if you want to pass your own data to it) make the following call:
C and C++ |
Copy Code
|
IG_status_bar_CB_register ( my_status_bar_CB_func, &myPrivateData );
|
Your status bar callback function must be of type LPFNIG_STATUS_BAR. Whenever called by ImageGear, your status bar callback function will be called with the following argument list:
C and C++ |
Copy Code
|
BOOL ACCUAPI my_status_bar_CB_func ( LPVOID lpPrivate, PIXPOS cYPos,
DIMENSION dwHeight );
|
Note the following:
- The function returns an AT_BOOL value, TRUE or FALSE. Return TRUE to have ImageGear proceed normally, return FALSE to tell ImageGear to put an IGE_INTERRUPTED_BY_USER error in the error stack and return from the IG_...() call it is processing (that is, to abort the operation returning the above-named error).
- The second argument indicates the raster line number just processed.
- The third argument indicates the total number of raster lines in the image. However, since some functions do not process the lines in order, the quantity (cYPos/dwHeight) in general will not tell you the fraction completed. Instead, your callback function should count the number of times it has been called since the operation began, and divide this count by dwHeight to obtain the fraction completed.