I though I'd share this and as for any feedback. Today I was experimenting with a borrowing a Delphi concept and implementing it in C#. I wanted to be able to do this in C#:
procedure WMMouseMove(var Message: TWMMouseMove); message WM_MOUSEMOVE; And I believe I came up with a similar yet workable enough solution to doing the same thin in C#. Here is what the C# code looks like: [Message(Messages.MouseMove)] private void MouseMove(Type type, Message message) { BaseHandler(type, message); // message handling code here } Invocation: instance.Dispatch(incommingMessage); Where "incommingMessage" is a message or message derived object, and instance is a "DispatchObject". Mind you, I am doing a few things here. 1) Dispatch calls only the most derived method with the matching message id. 2) The name of the method "MouseMove" is irrelevent. The id is used to find the method. 3) Inherited message handlers can be invoked through the protected "BaseHandler" method. 4) If no methods with a matching id are found, the virtual "DefaultHandler" method is called. Source code listing: http://codebot.org/dispatch.txt _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal