我需要多个使用具有相同 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/