Long time ago, when Windows Mobile devices where called Pocket PC's, when the most popular hand held device had the name that was starting form the letter "I" (not the IPod dummy, it's IPAQ), when the only way to develop for these devices was to use eMbedded Visual Basic or C++, when developing for devices was my side business / hobby,  I had created a subclassing control for eVB developers that was called MessageCE. (The internet still holds the white paper that I had written on its usage).  It was a COM component that allowed to subclass forms and controls in eVB programs. Subclassing is a very old technique that windows developers have been using if the default behaviour of the controls would not fit the requirements and they would want to add new features or change the control's behaviour. The essense of this technique is to replace the original window procedure with your own and process the messages in your code. Fast forward a few years when the first beta of the .NET Compact Framework came out and I started playing with it. While trying to create my own HTML viewer control I discovered that there would not be any way for me to subclass the manually created control (the delegates as native callbacks were not supported at the time) and I started complaining about this defficiency on the Microsoft newsgroups devoted to .NET CF other developer forums. My feedback got noticed and I was contacted by the PM from .NET CF product group. She asked me if I would like to visit Redmond where the SDR would be hold for the partners to discuss the .NET CF and they wanted to show me some solution to the problem I raised on the newsgroups. When I arrived in building 20 at Microsoft campus I was shown a new addition to the CF -  MessageWindow class and asked if it would fit my needs. It wasn't a perfect solution, but it could work. In a couple of hours I wipped up a native helper library that would do the actual control subclassing and would send the messages to the instance of the MessageWindow. This code subsequently has become a basis for the managed controls that I created and made available through my company's (Intelliprog, Inc) web site: HTMLViewer and RichInk controls.

The window subclassing has become much easier since .NET CF v2 had added the support for the delegates as native callbacks and I was able to create NativeWindow class that has become a part of the SDF afterwards. Tim Gerken from the CF team has created WndProcHooker class which was documented in MSDN later on.

So a few months ago while working on a demo for TechEd, I created a new version of the subclassing control - Message Control - that would utilize some of the capablities of C# 3.0 and make the control subclassing an easy and user friendly process. I also wanted to make the resulting code to be compatible with the desktop way of control subclassing - just override the WndProc on the derived class. In the next few posts I'll show you the code and a usage scenarios for the Message control.