XxBartmanxX Posted December 9, 2003 Posted December 9, 2003 Hey, I don't know how many of you are familiar with C++ and Win32 programming, but here is what I would like to do in C#. I need to write my own event handler, much like you would write a message loop in C++. Bascially, I want to be able to handle every event fired off myself. For example, this is similar to what it would look like in C++. ... switch(msg) { case WM_RMCLICK: ... break; case WM_MINIMIZE: ... break; case WM_QUIT: ... break; default: ... break; } ... Take note that the ellipses are there as place holders for code :) Hopefully what I need to do is possible in C#, and hopefully you understand what I tried to explain. Thanks Quote
*Experts* Bucky Posted December 9, 2003 *Experts* Posted December 9, 2003 The method of handling events is much more robust than this in C# and other .NET languages. I suggest you read up on [mshelp=ms-help://MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconevents.htm]events and delegates[/mshelp]. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
XxBartmanxX Posted December 9, 2003 Author Posted December 9, 2003 I glanced at that briefly in my search through books and msdn, thanks for indicating that to be the right way to go. Quote
*Gurus* divil Posted December 10, 2003 *Gurus* Posted December 10, 2003 If you really want to write your own message loop, there's nothing to stop you using the standard api functions to do this. Just declare the functions using platform invoke in the normal way. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
XxBartmanxX Posted December 11, 2003 Author Posted December 11, 2003 Do you know what I just realized? You can override the WndProc of a form, and that was exactly what I was looking for lol Quote
Recommended Posts