| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2515 人关注过本帖
标题:关于C++中SetTimer()的问题
只看楼主 加入收藏
tlby
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2011-10-21
收藏
 问题点数:0 回复次数:5 
关于C++中SetTimer()的问题
UINT SetTimer(
  HWND hWnd,
  UINT nIDEvent,
  UINT uElapse,
  TIMERPROC lpTimerFunc
);
第二个参数也就是定时器的ID,是自己随便定的吗?只要不重复就行吗?
他触发时是触发整个程序嘛?菜鸟刚学,望多多指教~!
搜索更多相关主题的帖子: 定时器 
2011-10-23 14:51
naruto01
Rank: 4
等 级:业余侠客
帖 子:103
专家分:280
注 册:2011-5-23
收藏
得分:0 
MSDN Library
nIDEvent
[in] Specifies a nonzero timer identifier. If the hWnd parameter is NULL, and the nIDEvent does not match an existing timer then it is ignored and a new timer ID is generated. If the hWnd parameter is not NULL and the window specified by hWnd already has a timer with the value nIDEvent, then the existing timer is replaced by the new timer. When SetTimer replaces a timer, the timer is reset. Therefore, a message will be sent after the current time-out value elapses, but the previously set time-out value is ignored. If the call is not intended to replace an existing timer, nIDEvent should be 0 if the hWnd is NULL.
2011-10-23 15:19
tlby
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2011-10-21
收藏
得分:0 
回复 2楼 naruto01
看不大懂呀!你看我这样可以不?
SetTimer(hwnd,1,500,NULL);
2011-10-23 15:25
naruto01
Rank: 4
等 级:业余侠客
帖 子:103
专家分:280
注 册:2011-5-23
收藏
得分:0 
只要非零值,就好了。
表示设定一个与hwnd关联的Timer, 这个Timer的标识是1, 触发时间是0.5s, time-out时在消息队列里放入一个WM_TIMER消息
我也是刚学,如果理解有错,概不负责啊
2011-10-23 15:33
gball
Rank: 3Rank: 3
等 级:禁止发言
帖 子:56
专家分:192
注 册:2011-9-23
收藏
得分:0 
提示: 作者被禁止或删除 内容自动屏蔽

在网吧通宵泡论坛发贴子,挣齐所有大学学费,详情请点击:   http://www.vikkk.tk/
2011-10-23 16:01
gball
Rank: 3Rank: 3
等 级:禁止发言
帖 子:56
专家分:192
注 册:2011-9-23
收藏
得分:0 
提示: 作者被禁止或删除 内容自动屏蔽

在网吧通宵泡论坛发贴子,挣齐所有大学学费,详情请点击:   http://www.vikkk.tk/
2011-10-23 16:40
快速回复:关于C++中SetTimer()的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024844 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved