W
Wasabi
Hi,
maybe OT...
I'm writing a windowless sw, I need a timer for each object that call a
non-static function ( myFunc() ) and refresh a value ( myValue ).
I've wrote this code:
class myClass {
public:
int myValue;
static void CALLBACK myClass::TimeProc(UINT uID,UINT uMsg,DWORD
dwUser,DWORD dw1,DWORD dw2) {
reinterpret_cast<myClass*>(dw1)->myFunc();
}
void myClass::myFunc () {
printf ("!! myFunc() !!");
myValue = 100;
}
void myClass::startTimer() {
MMRESULT myTimer =
timeSetEvent(1000,0,TimeProc,reinterpret_cast<DWORD_PTR>(this),TIME_PERIODIC|TIME_CALLBACK_FUNCTION);
}
};
I've tryed to pass a class pointer to the static callback function.
myFunc () is called, but when I try to change myValue it returns
NullPointerException error
any ideas ???
ps: sorry for my horrible english
maybe OT...
I'm writing a windowless sw, I need a timer for each object that call a
non-static function ( myFunc() ) and refresh a value ( myValue ).
I've wrote this code:
class myClass {
public:
int myValue;
static void CALLBACK myClass::TimeProc(UINT uID,UINT uMsg,DWORD
dwUser,DWORD dw1,DWORD dw2) {
reinterpret_cast<myClass*>(dw1)->myFunc();
}
void myClass::myFunc () {
printf ("!! myFunc() !!");
myValue = 100;
}
void myClass::startTimer() {
MMRESULT myTimer =
timeSetEvent(1000,0,TimeProc,reinterpret_cast<DWORD_PTR>(this),TIME_PERIODIC|TIME_CALLBACK_FUNCTION);
}
};
I've tryed to pass a class pointer to the static callback function.
myFunc () is called, but when I try to change myValue it returns
NullPointerException error
any ideas ???
ps: sorry for my horrible english