Home » U++ Library support » U++ Widgets - General questions or Mixed problems » How do I use WIndows Message pump timer?
Re: How do I use WIndows Message pump timer? [message #3291 is a reply to message #3290] |
Thu, 18 May 2006 05:20   |
 |
mirek
Messages: 14267 Registered: November 2005
|
Ultimate Member |
|
|
jeff1101 wrote on Wed, 17 May 2006 22:01 | Sorry if this topic should not be here.
I have reused CounterCtrl. How do I write the code to set a timer that will trigger a callback function at the appropriate time ?
I dont want to start a new thread just to do this. I do want the message pump of windows to call the callback function when the timer is set.
Thanks.
|
void *SetTimeCallback(int delay_ms, Callback cb, void *id = NULL); // delay_ms < 0 -> periodic
void KillTimeCallback(void *id);
bool ExistsTimeCallback(void *id);
dword GetTimeClick();
inline
void PostCallback(Callback cb, void *id = NULL) { SetTimeCallback(1, cb, NULL); }
class TimeCallback
{
public:
~TimeCallback() { Kill(); }
void Set(int delay, Callback cb) { ::SetTimeCallback(delay, cb, this); }
void Kill() { ::KillTimeCallback(this); }
void KillSet(int delay, Callback cb) { Kill(); Set(delay, cb); }
};
......
class Ctrl {
....
void SetTimeCallback(int delay_ms, Callback cb, int id = 0);
void KillTimeCallback(int id = 0);
void KillSetTimeCallback(int delay_ms, Callback cb, int id);
bool ExistsTimeCallback(int id = 0) const;
void PostCallback(Callback cb, int id = 0);
void KillPostCallback(Callback cb, int id);
.....
};
Mirek
|
|
|
Goto Forum:
Current Time: Sat Aug 16 07:09:49 CEST 2025
Total time taken to generate the page: 0.06652 seconds
|