The Message Blaster Custom Control Modifications
and Helpfile are Copyright 
Arjen Broeze, SheAr software
Created: September 14, 1993

Description

The Microsoft Visual Basic development environment is not based on a message-driven 
programming model. Instead, Visual Basic supports a predefined set of events for each object 
(form or control) that you create. An application written in Visual Basic cannot respond to 
messages from Microsoft Windows that are not handled directly by a Visual Basic event. The 
Message Blaster is a Visual Basic control that addresses this restriction by allowing you to catch 
and process Windows messages from Visual Basic. 

File Name BLASTER.VBX

Remarks

The Message Blaster allows an application to respond to events that are not built into Visual 
Basic. You can use the Message Blaster control to process any message from Windows except 
for WM_CREATE and WM_NCCREATE messages. For example, you can process:

-	WM_MENUINIT and WM_MENUSELECT messages, to change status bar text as the 
user moves through menu items. .
-	WM_NC* (nonclient) messages, to create captions. 
-	WM_DROPFILE messages, to implement a drag-and-drop interface.


Note  Like the timer control, the Message Blaster control is visible on the form but does not 
appear in your application's interface. (If your form contains multiple Message Blaster controls, 
they will appear stacked in the upper-left corner the next time you open the form (not in VB 1.0)).

Usage

To use the Message Blaster, perform the following steps:


1.	Add the Message Blaster control to your project. The Message Blaster icon will appear in 
the Visual Basic tool-pallette.

2.	In the Form_Load event procedure for the form, set the hWndTarget property of the 
Message Blaster control to specify the window handle of the target object whose 
messages you want to process. 

3.	Specify the messages to capture in the Message Blaster control MsgList property array in 
the Form_Load event procedure for the form. Here is a sample Form_Load event 
procedure that initializes a Message Blaster control:



Sub Form_Load ()
    MsgBlaster1.hWndTarget = text1.hWnd
    MsgBlaster1.MsgList(0) = WM_NCHITTEST
End Sub


4.	Add code to handle the messages when the application receives a Message Blaster 
event.  



Some Warnings

You can have up to 25 Message Blasters on a system at one time. This limit covers all 
applications, not 25 Message Blasters per application. To reduce the number of Message 
Blasters that your application uses, you can reassign the target object for a Message Blaster at run 
time. For example, if your application has five edit controls and you want to process messages for 
each one, you can use one Message Blaster and change its target object as the focus moves to 
each edit control. This method also saves coding effort if each target object has the same or 
similar message-handling needs.

The initial version of the Message Blaster Custom Control (MSGBLAST.VBX) didn't work with 
Visual Basic 1.0. Because the Message Blaster Custom control may be even more needed in this 
early version of Visual Basic than in the newer versions of Visual Basic, the code for the Message 
Blaster control was revised to allow its use with VB 1.0. The filename of the custom control was 
changed to BLASTER.VBX to avoid problems with other products that use the original version of 
the Message Blaster. However, using the Message Blaster with Visual Basic version 1.0 requires 
more work because this VB-version does not provide the hWnd property for objects; you need to 
hunt down the object's window handle by using Windows functions such as GetWindow and 
GetFocus. If you're still using Visual Basic 1.0, consider upgrading to version 2.0 or later.



Distribution Note  When you create and distribute applications that use the Message Blaster 
control, you should install the file BLASTER.VBX in the customer's Microsoft Windows \SYSTEM 
subdirectory.



The Message Blaster Custom Control is Copyright  	

	Ed Staffin, Microsoft Consulting Services
	Kyle Marsh, Microsoft Developer Network Technology Group
	Created: April 30, 1993
