Friday, September 11, 2015

Hooking in C#

In general, a hook is a concept where an application intercepts events, such as messages, mouse actions, and keystrokes.

A hook is a point in the system message-handling mechanism where an application can install a subroutine to monitor the message traffic in the system and process certain types of messages before they reach the target window procedure.

A function that intercepts a particular type of event is known as a hook procedure. A hook procedure can act on each event it receives, and then modify or discard the event.

The following mentioned some example uses for hooks

Monitor messages for debugging purposes
Provide support for recording and playback of macros
Provide support for a help key (F1)
Simulate mouse and keyboard input
Implement a computer-based training (CBT) application

Points to be noted
Hooks tend to slow down the system because they increase the amount of processing the system must perform for each message. You should install a hook only when necessary, and remove it as soon as possible.

No comments:

Copyright © Codingnodes,2014.All Rights Reserved.