Sunday, June 10, 2007

Windows Message Handling, in C#

In C#, we can make a control (e.g., panel, button, textfield, etc) to handle Windows messages that come into the control class by overriding the WndProc method.

protected override void WndProc(ref Message m)
// process and/or update message

// let base class handle the message
base.WndProc(ref m);

// print out message to Debug