求助:关于CWnd::SetTimer()的使用

blackmurder 2006-09-07 06:15:44
本人系菜鸟,不太会用SetTimer()函数。如果我想让时间停留一段时间(比如0.1秒)该怎么办呢
...全文
446 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Y___Y 2006-09-07
  • 打赏
  • 举报
回复
SetTimer()函数用法
UINT SetTimer( UINT nIDEvent, UINT nElapse, void (CALLBACK EXPORT* lpfnTimer)(HWND, UINT, UINT, DWORD) );

Return Value

The timer identifier of the new timer if the function is successful. An application passes this value to the KillTimer member function to kill the timer. Nonzero if successful; otherwise 0.

如果函数成功,则返回新定时器的标识符。应用程序可以将这个值传递给KillTimer成员函数以销毁定时器。如果成功,则返回非零值;否则返回0。

Parameters

nIDEvent

Specifies a nonzero timer identifier.

指定了不为零的定时器标识符。

nElapse

Specifies the time-out value, in milliseconds.

指定了定时值;以毫秒为单位。

lpfnTimer

Specifies 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.

指定了应用程序提供的TimerProc回调函数的地址,该函数被用于处理WM_TIMER消息。如果这个参数为NULL,则WM_TIMER消息被放入应用程序的消息队列并由CWnd对象来处理。
KillTimer()用法
BOOL KillTimer( int nIDEvent );

Return Value

Specifies the outcome of the function. The value is nonzero if the event was killed. It is 0 if the KillTimer member function could not find the specified timer event.

指定了函数的结果。如果事件已经被销毁,则返回值为非零值。如果KillTimer成员函数不能找到指定的定时器事件,则返回0。

Parameters

nIDEvent

The value of the timer event passed to SetTimer.

传递给SetTimer的定时器事件值。

blackmurder 2006-09-07
  • 打赏
  • 举报
回复
受教了
AFIC 2006-09-07
  • 打赏
  • 举报
回复
Sleep不就行了?
Y___Y 2006-09-07
  • 打赏
  • 举报
回复
直接用Sleep(100);,不必用SetTimer()函数

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧