5/23/94 Message Blaster v2.1 Minor bug fix. Had a problem with deleting user defined messages in the message center. Got an internet account. Should make it easier to get ahold of me. My new internet address is: edstaff@mcs.com 4/23/94 Message Blaster v2.0 Wow, lot's of improvements! Let see ... perhaps the biggest thing is that the only code you have to write any more is in the message event. I added a new property called the message center. It is vastly easier to use than the original. As a matter of fact, to use it requires NO code to set up. The only thing you have to do is respond to the message event! How? I've added a new property called the MsgCenter. When you double-click on this property it will bring up a dialog that will allow you to choose which control you want to catch messages for, what messages you want to catch, and how you want to process them. The cool part is that you don't have to choose the target hWnd at run time (Although, you still can if you need to... this thing is 100% backward compatible). All of the original functionality is still there, the only change is to the UI. Miscellaneous new features. I added top and left properties so you can move the thing to where you want it at design time and it will stay there. Before, you would put it on the form someplace and the next time you brought it up it "magically" moved to the upper left corner. I added a version stamp resource for those of you who need to keep track of that. For those of you who have never used it, I have included a winword doc that is the original text of the MSDN ariticle that explains the ins and outs. Also in the zip file you will find several examples of how to use the message blaster. These include a simple method for tying menus and status bars together so you can display messages as the user moves thru menus; a method for effectively creating a custom cursor in VB; and finally a method for creating a small caption bar in VB. Good stuff. And you can't beat the price. Also, I recently left Microsoft to start my own business. Therefore, this new version is longer free. It is shareware with a suggested price of $25. Check the about box property of the details. Hey, it's only 25 bucks for something I worked a lot on, so if you want to see more, let me know your using it and appreciate it! For your 2000 bits, I'll send you the source and you'll get free upgrades from here on out. Also, I am working on a OLE control version of it, to be coming to a theater new you. I will be happy to provide as much tech support as I have time for. However, you should understand that this control and it's use, assumes you have knowledge of the underlying architecture of windows. If you don't understand Window's messaging, I don't have the time to explain it. Lastly, I build these things because I thing they are fun to build. If you have an idea for a control that you think would be a winner, drop me a line or give me a call. Oh yeah, one other thing, Bugs. While there are no know bugs in the vbx at this time, you never know. If you find one, let me know so I can fix it. This thing has been in use by many, many programmers for a long time, so it's pretty stable. I am proud to say that it ships as part of a number of Microsoft products! Ed Staffin 758 N. Williams Drive Palatine, IL 60067 phone 708-358-0484 Later ... Ed Message Blaster v. 1.1 Ok, here is the second release of my message blaster custom control for VB2. The primary differences are several bug fixes and a new message event parameter. One other new feature is that you can now change the target object at run time by merely setting the hWndTarget property. What is it? Well, it's a control that will allow the VB programmer to catch and process Windows messages directly from within VB. This is accomplished by placing a message blaster on your form and specifying the object you want to catch messages for and what messages to catch. The message blaster should be able to catch just about any message for any control or form. You can catch up to 25 messages per target object. I suppose, if you needed to catch more than that, you could use 2 blasters and point them at the same object, but the idea of catching 25+ messages seems remote to me. Normally, you would specify the target controls and what messages to catch in the form load section of your form. For example: Sub Form_Load () Const PREPROCESS = -1 Const EATMESSAGE = 0 Const POSTPROCESS = 1 MsgBlaster1.hWndTarget = text1.hWnd MsgBlaster1.MsgList(0) = WM_NCHITTEST MsgBlaster2.hWndTarget = text2.hWnd MsgBlaster2.MsgList(0) = WM_LBUTTONDOWN MsgBlaster2.MsgPassage(0) = EATMESSAGE MsgBlaster2.MsgList(1) = WM_RBUTTONDOWN MsgBlaster3.hWndTarget = example.hWnd MsgBlaster3.MsgList(0) = WM_MENUSELECT End Sub Now, when you run your application, the Message Blaster will monitor the message stream for your targeted controls. When it finds a message that you are interested in it will fire an event as follows: Sub MsgBlaster1_Message (MsgVal As Integer, wParam As Integer, lParam As Long, ReturnVal As Long) ' Do your message processing here MsgBox "Just got a WM_NCHITTEST" ' Do some processing to see where you hit and then return the appropriate ' value to windows ReturnVal = HT_BORDER End Sub When dealing with windows messages there may be times when you would not want to pass the message you catch on to VB. This is why I provide a property array called MsgPassage. This property allows you to specify how you want the message blaster to handle target messages. PREPROCESS means that the message will be passed on to VB prior to the Message Blaster's message event is fired. EATMESSAGE is just what is suggests, the Message Blaster eats the message and fires the message event. POSTPROCESS, which is the default, means that the Message Blaster fires the message event first, then passes the message on to VB. There is only a couple of messages that I know of that I can't catch...WM_CREATE and WM_NCCREATE. This is because The target control is already existant when you tell the message blaster about it. I suppose I should put in a caution here. This is, in some ways, subverting VB. Because of this, the user of this control should be careful how they use this control. I have found that if VB is already providing support for certain messages (i.e. click, keypress etc.) don't use my control to catch them. Although it will work just fine, you may, on certain messages not always get the results you would expect. Here are some of the things that I have heard that people want to use this for: 1. Catching WM_MENUINIT and WM_MENUSELECT messages so they can change status bars as the user moves through menus. 2. Catching WM_NCHITTEST for all kinds of things. 3. Catching WM_DROPFILE 4. Catching DDE stuff. 5. Catching WAV file stuff And I'm sure you'll find more. I am including a file called Messages.txt that contains most of the Windows Messages defined in VB format (i.e. Global Const WM_MENUSELECT = &H11F). There is also and example program that illustrates the use of the Message Blaster. A new example, created by Jim Cash and Randall Kern, show how to use the msgblaster to create small captioned window, similar to that of the toolbox in vb. Check it out it's cool! Please let me know if there are any bugs. Also, if you have any ideas for improvement let me know. I would be very interested in hearing how you use this control. Oh, by the way, check out the about box, it's good for my head. I would like to thank chrisfr who helped me find a nasty bug that was keeping me up at night. Also, thanks to Jimc and t-randyk for a nice improvement to the program. Enjoy it!