NidhiSree
NidhiSree

Reputation: 65

Does System.Windows.Forms.Timer send WM_TIMER message?

Does System.Windows.Forms.Timer send WM_TIMER message ?

Basically I want to set a timer that should generate

WM_TIMER  

message for every 5 seconds. I am using

System.Windows.Forms.Timer

and the

Tick 

event is handled. But I am not getting WM_TIMER message in my WndProc().

Upvotes: 0

Views: 763

Answers (1)

Hans Passant
Hans Passant

Reputation: 941307

Yes, WM_TIMER is what makes a Winforms Timer tick. Unobserved in your code however, it creates its own window, it doesn't use yours. It is an invisible one, the underlying .NET class is TimerNativeWindow, a private class of the Timer class. You can't ever override its WndProc(). Technically you could subclass it with NativeWindow after digging out the handle with Reflection, but that way lies dragons and should never be necessary.

Upvotes: 1

Related Questions