Progress updates from callback function
-
Here's something that's puzzling me: the purpose of the callback function for AVISave is to update a Progress control with the percent done. But the callback function must be global or static, and only takes an int nPercent argument, so how can I access any Progress control or dialog member variables from this callback function?? ***** Jake Palmer www.duke.edu/~jp6
-
Here's something that's puzzling me: the purpose of the callback function for AVISave is to update a Progress control with the percent done. But the callback function must be global or static, and only takes an int nPercent argument, so how can I access any Progress control or dialog member variables from this callback function?? ***** Jake Palmer www.duke.edu/~jp6
I think you might get away with something similar to the following; YourDialog.h:
class CYourDialog : ... {
static CYourDialog * pThis;
static LONG SaveCallback ( int nPercent );};
YourDialog.cpp:
CYourDialog * CYourDialog::pThis = NULL;
CYourDialog::CYourDialog () {
pThis = this;
}LONG CYourDialog::SaveCallback ( int nPercent ) {
// // use the pThis pointer to access the members/variables of your class //
}
Ben Burnett --------- On the topic of code with no error handling -- It's not poor coding, it's "optimistic" ;)