c++ - c++ 中的 multiple::setTimer

标签 c++ windows

我需要多个使用具有相同 EventID 的::SetTimer 函数的计时器。使用::CreateWindow 创建多个窗口句柄,然后将每个计时器分配给创建的窗口句柄,这可能/一个好主意吗?还有其他选择吗?


编辑:无论如何,我只想知道这里发生了什么:

int eventID = 0;
hWnd1 = ::CreateWindow(...);
hWnd2 = ::CreateWindow(...);
::SetTimer(hWnd1, eventID, ...);
::SetTimer(hWnd2, eventID, ...);

是否每个 hWnd 都有自己的 eventID 列表?他们是独立处理的吗?我不想讨论这个设计是否有意义..

最佳答案

来自 http://msdn.microsoft.com/en-us/library/ms644906%28v=vs.85%29.aspx

The timer identifier, nIDEvent, is specific to the associated window. Another window can have its own timer which has the same identifier as a timer owned by another window. The timers are distinct.

关于c++ - c++ 中的 multiple::setTimer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6506635/

相关文章:

c++ - 停止相机在墙壁(或障碍物)处的移动

c++ - 解析 C++ 定义的方法?

windows - 闪存驱动器上的批处理文件 - 如何检查操作系统架构?

c++ - 让 alpha 混合与 CImageList 一起工作

c++ - 互斥(在静态库中)

c++ - J编程语言中的数组

c++ - 如何从返回类型为pair的C++函数返回等效的nullptr?

C++ - 智能指针 vector 图 - 全部继承自同一基类

c++ - 如何测试中断延迟?

c - 在 Windows 上为 stdlib.h 函数包含什么库?