UINT SetTimer( UINT nIDEvent, UINT nElapse, void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT, UINT, DWORD) );
ParametersnIDEventSpecifies a nonzero timer identifier.nElapseSpecifies the time-out value, in milliseconds.lpfnTimerSpecifies the address of the application-supplied TimerProc callback function that processes the WM_TIMER messages. If this parameter is NULL, the WM_TIMER messages are placed in the application’s message queue and handled by the CWnd object.看不太懂,请帮我用汉语说说,不是直接翻译。说清这三个变量什么意思,该怎么赋值就行了。谢谢
ParametersnIDEventSpecifies a nonzero timer identifier.nElapseSpecifies the time-out value, in milliseconds.lpfnTimerSpecifies the address of the application-supplied TimerProc callback function that processes the WM_TIMER messages. If this parameter is NULL, the WM_TIMER messages are placed in the application’s message queue and handled by the CWnd object.看不太懂,请帮我用汉语说说,不是直接翻译。说清这三个变量什么意思,该怎么赋值就行了。谢谢
解决方案 »
- 谁真正明白C++,类到底是怎么回事情
- SQL中定义的存储过程参数VARCHAR(20),在VC中用什么数据类型的参数匹配
- DLL 菜问
- ## 放在本地运行没有问题,放在文件服务器上出错
- 一个带参数的构造函数,如何在另一个类的文件中申明
- 想考系统设计师(高级程序员),不知这个证有用没用?各位达人给个意见。来者有分,不够再开。
- 求教:在C++中如何解析正则表达式?比如用户指定这样一个表达式: ~^[ *][0-9]*[a-gkp] ,我该怎么去解释并生成用户指定的字符串类型?
- 请问大家在软件开发项目中是如何进行多人协作模块化分工的?
- 谁知道在MFC中控制屏幕要用何API?
- 如何处理这样的快捷键消息?
- 在位图中写字,怎么设置字体大小?
- 为什么出现这种栈呢?
非零标识符nElapseSpecifies the time-out value, in milliseconds.
指定的超时的时间间隔,以毫秒为单位lpfnTimerSpecifies the address of the application-supplied TimerProc callback function that processes the WM_TIMER messages. If this parameter is NULL, the WM_TIMER messages are placed in the application’s message queue and handled by the CWnd object.
回调函数。指定处理WM_TIMER消息的回调函数的地址。如果这个参数为NULL,WM_TIMER消息被发送到应用程序消息队列中然后被CWnd对象处理。调用SetTimer(1, 1000, NULL); // SetTimer,1秒钟响应一次
void CXX::OnTimer(UINT nID)
{
if(nID == 1)
{
...
}
CXX::OnTimer(nID);
}
第二参数: 是时间,以毫秒为单位。
第三参数: 一时半会说不清楚,一般设为NULL就可以了举例:定义两个计时器,一个1秒种轮回一次,另一个3秒种轮回一次SetTimer(1,1000,NULL);//这是事件1,1秒钟的
SetTimer(2,3000,NULL);//这是事件1,3秒钟的在时间的响应函数据里就可以这样
void CXXXXX::OnTimer(UINT nIDEvent)
{
if(nIDEvent==1)
{
//这里的代码1秒执行一次
}
else if(nIDEvent==2)
{
//这里的代码3秒执行一次
}
}