I keep hearing the term hooks, used in software, and I was wondering if someone could explain the concept behind hooks to me?
Printable View
I keep hearing the term hooks, used in software, and I was wondering if someone could explain the concept behind hooks to me?
under windows OS you can read here:
Hooks
Cheers
In few words: Generally, hooks are predefined points in the execution flow of a system into which you can "hook" your own processing. This is usually done by providing a way for you to supply callback function pointers (C) or by means of virtual functions you can implement (C++).Quote:
Originally Posted by davejohnston83
As an example under Windows: Normally, all user actions (mouse clicks, keyboard input) are handled by the system and dispatched to the affected windows, where they arrive in the form of messages. However, Windows provides a way for application programmers to hook into this procedure (via the SetWindowsHookEx API): It allows you to provide a pointer to a callback function which is called each time the system is about to process a mouse message, and gives you a chance to see, handle, change or suppress that message before application windows (or other clients in the hooking chain) get to see them.
Thats great guys, thanks - another question cleared up.