Subclassing & Hooking with Visual Basic offersdevelopers a unique way to customize Windows behavior. Windows is amessage-based system. Every action you request creates one or moremessages to carry out the action. These messages are passed betweenobjects and carry with them information that gives the recipientmore detail on how to interpret and act upon the message. WithSubclassing and the Windows hooking mechanism ("hooks"), you canmanipulate, modify, or even discard messages bound for otherobjects within the operating system, in the process changing theway the system behaves. What kinds of results can you achieve usingthe power of subclassing and hooking? Here are just a few of thepossibilities:
Determine when a window is being activated ordeactivated and respond to this change.
Display descriptions of menu items as the mousemoves across them.
Disallow a user to move or resize a window.
Determine where the mouse cursor is and respondaccordingly.
Determine when the display resolution has beenchanged.
Monitor the system for a low system resourcecondition.
Modify or disallow keystrokes sent to a window or acontrol.
Create an automated testing application.
Determine when an application is idle.
Along with this power comes responsibility; Windows is veryunforgiving if subclassing and hooking are used incorrectly.Subclassing & Hooking with Visual Basic demonstrates thevarious techniques for intercepting messages bound for one or morewindows or controls: the intercepted message can be left in itsoriginal state or modified; afterwards, the message can be sent toits original destination or discarded. For both VB 6 and VB.NETdevelopers, Subclassing & Hooking with Visual Basicopens up a wealth of possibilities that ordinarily would becompletely unavailable, or at least not easy to implement.