Is KillTimer necessary?
Timers set from HWND
s are implicitly destroyed by the window (hwnd
) being destroyed. So no, you don't have to clean up your timers when the window exits.
But it's a good practice to have all your resources related to the window cleaned up on window close.
The timer will be destroyed automatically by Windows on process exit.
But bear in mind that (so it appears) your timer belongs to the window, not the process. So if your application allows these windows to be created and destroyed within a process, you'll be leaking timers.
It's always good practice to clean things up explicitly, because otherwise the lack of cleanup can come back to bite you later on.