soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
STimerGenerator.h
1#ifndef __STIMERGENERATOR__H__
2#define __STIMERGENERATOR__H__
3
4#include "core/SSingletonMap.h"
5
6SNSBEGIN
7
8/**
9 * @struct TIMERINFO
10 * @brief 定时器信息结构体
11 */
13{
14 SAutoRefPtr<IEvtSlot> pEvtSlot; // 事件槽对象指针
15 BOOL bRepeat; // 是否重复定时器
16 LPARAM uData; // 用户数据
17};
18
19/**
20 * @class STimerGenerator
21 * @brief 定时器生成器类,继承自单例映射类
22 */
23class STimerGenerator : public SSingletonMap<STimerGenerator, TIMERINFO, UINT_PTR> {
24 SINGLETON2_TYPE(SINGLETON_TIMERGENERATOR)
25
26 public:
27 /**
28 * @brief 析构函数
29 */
31
32 /**
33 * @brief 设置定时器
34 * @param pEvtSlot 事件槽对象指针
35 * @param nElapse 定时器间隔时间(毫秒)
36 * @param bRepeat 是否重复定时器
37 * @param uData 用户数据
38 * @return 定时器ID
39 */
40 UINT SetTimer(IEvtSlot *pEvtSlot, UINT nElapse, BOOL bRepeat, LPARAM uData);
41
42 /**
43 * @brief 清除定时器
44 * @param uID 定时器ID
45 */
46 void ClearTimer(UINT_PTR uID);
47
48 /**
49 * @brief 定时器回调函数
50 * @param hwnd 窗口句柄
51 * @param uMsg 消息ID
52 * @param idEvent 定时器ID
53 * @param dwTime 时间戳
54 */
55 static VOID CALLBACK _TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
56};
57
58SNSEND
59
60#endif // __STIMERGENERATOR__H__
Smart pointer class for managing COM-style reference-counted objects.
定时器生成器类,继承自单例映射类
~STimerGenerator()
析构函数
void ClearTimer(UINT_PTR uID)
清除定时器
static VOID CALLBACK _TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
定时器回调函数
UINT SetTimer(IEvtSlot *pEvtSlot, UINT nElapse, BOOL bRepeat, LPARAM uData)
设置定时器
定时器信息结构体