Hooks are a powerful feature of Windows and can be used to trap nearly all events in the Windows environment. This example shows how to trap mouse events and implements a simple window manager. It allows you to move and resize windows, easily following the style of many window managers in the UNIX X-Window environment.
With this tool, any window on your Desktop can easily be dragged with the left-mouse button while holding down the ALT key, starting anywhere in the window's client area. In the same way, it is possible to resize any window while dragging with the right mouse-button, holding down ALT. That's in my opinion far more comfortable than aiming with the mouse for the border or a corner of the window :)
The tool consists of two parts. First the main program that loads the second part - a DLL that will subsequently be injected in other processes to trap mouse events. For details about this, you may refer to other great articles at CodeProject as for example Hooks and DLLs by Joseph M. Newcomer in the DLL-section. The main program further installs a tray icon (warning: programmer's art :) ), that allows the user to quit the tool.