PRB: KillTimer Function Kills the Timer Created by Another Application (312406)
The information in this article applies to:
- Microsoft Windows 95
- Microsoft Windows 98
- Microsoft Windows 98 Second Edition
This article was previously published under Q312406 SYMPTOMS
When two applications create timers by calling the SetTimer function, and the window handle is set to NULL, one application may kill the timer created by the other application.
This behavior can occur under the following scenario:
- Application A allocates a timer (id=A), and then kills it.
- Application B allocates a timer (id=A is reused).
- Application A kills this timer again.
- Application A allocates a timer (id=A is reused), and then kills it.
- Application B attempts to kill the timer (id=A), but this operation fails.
CAUSE
This behavior can occur because timers are allocated from a global resource. When the KillTimer function is called with a timer ID, it destroys any timer that it is directed to. Furthermore, SetTimer may reuse timer IDs when the window handle parameter is set to NULL. In this case -- where multiple applications create and destroy timers against the NULL window, and one application destroys a timer twice -- the possibility of a collision exists.
RESOLUTION
To resolve this issue, modify your code so that it always uses a non-NULL window handle when it creates timers.
STATUSThis behavior is by design.
Modification Type: | Minor | Last Reviewed: | 12/20/2004 |
---|
Keywords: | kbprb KB312406 |
---|
|