>>> So what's your proposal? while ( SetTimer( id ) != ERROR_SUCCESS ) ++id;? The point is, when you install a thread timer your code no longer controls which ID's are in use and which ones aren't.
Exactly, if I *install* a timer then I don't know the ID so passing an ID should fail. In other words, to *create* a timer one should call SetTimer(0, 0) and calling SetTimer(0, InvalidID) should fail. You can still hit another timer accidentally but at least it won't leak.