The WndProc Method
WndProc is the default Windows message handling function for a given control, and the first method that receives messages on a form. The WndProc method can be overridden in order to implement specific message responses.
WndProc passes any unhandled messages to the Dispatch method.
VCL controls have a property called WindowProc that points to the WndProc method. This property can be used to replace or subclass the window procedure. Before assigning a new value to WindowProc, the original value should be stored. After completing any specialized message handling, call the original WindowProc to make sure the normal message processing works as expected.
Note: If you are a component writer customizing the window procedure for a descendent class, you should override the WndProc method instead of replacing or subclassing it.
Note: When overriding WndProc to provide specialized responses to messages, be sure to call the inherited WndProc method at the end, in order to dispatch any unhandled messages.