For example, when a window is resized or moved, several different types of messages are sent to the window that is being resized. With subclassing, the developer can control how and if the user can resize or move the window by intercepting and modifying a few of these messages. To illustrate the point further, the Windows operating system has hundreds of messages that it can send to a window. Imagine being able to control or manipulate any of these messages in your own unique way. This is the type of power that subclassing and hooking open up to the developer.
Hooking is somewhat different than subclassing.
Hooking allows the developer to intercept a specific group of messages. There are 15 different types of hooks that the Windows operating system exposes and each one of them intercepts a specific grouping of messages. Hooking is used when you want more control over a specific system. Just about any developer will run into problems that are easily solved by using subclassing or hooks. Many developers not familiar with subclassing or hooking may give up or try to create overly complex solutions for problems.