By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,148 Members | 1,285 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,148 IT Pros & Developers. It's quick & easy.

What is a hook

P: n/a
Can someone explain to me what a hook is?

Does it has something to do with a debugger?

Thanks
Jul 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi,
"Mohammad" <mj*******@hotmail.com> wrote in message
news:3d**************************@posting.google.c om...
Can someone explain to me what a hook is? A hook is a function that is executed somewhere in between or before another
function. For instance in windows you can place a hook (function) which will
receive all mouse movements. One can use this to create macro's. (I did
something like this in my free frachunt program). I redirected all mouse
messages to my function first (and forwarded them to the function that
originally would receive them) so I could 'replay' them later when the user
asked for it.

Does it has something to do with a debugger?
It has nothing to do with a debugger.

Thanks


Regards, Ron AF Greve.
Jul 19 '05 #2

P: n/a
A hook generally a code stub left in the code to support a future
enhancement.

In general the so called design hooks end up cluttering the code. Checkout
the following article:
http://www.eventhelix.com/RealtimeMa...epItSimple.htm

Sandeep
--
http://www.EventHelix.com/EventStudio
EventStudio 2.0 - Generate Sequence Diagrams and Use Case Diagrams in PDF
Jul 19 '05 #3

P: n/a
ev********@hotmail.com (EventHelix.com) wrote in message news:<56**************************@posting.google. com>...
A hook generally a code stub left in the code to support a future
enhancement.

In general the so called design hooks end up cluttering the code. Checkout
the following article:
http://www.eventhelix.com/RealtimeMa...epItSimple.htm

Sandeep


Is there a standard method of creating a hook, e.g., using a function pointer?

How is call to a function is intercepted but the hook function?

Can someone give a snippet of code?

Thanks
Jul 19 '05 #4

P: n/a
Hook is a general term to refer to any code written in the name
for future enhancement. That's all there is to it.

Sandeep
--
http://www.EventHelix.com/EventStudio
EventStudio 2.0 - Generate Sequence Diagrams and Use Case Diagrams in PDF
Jul 19 '05 #5

P: n/a
Mohammad wrote:
Can someone explain to me what a hook is?

Does it has something to do with a debugger?

Thanks


I always thought that a "hook function" was some function that the
system/library/toolkit you are working with calls for you in an event-
driven setup.

Consider a GUI toolkit: a View::mouseDown() member function gets called
by the system for you when the user clicks the mouse in some given View.
You inherit from View and implement your own mouseDown(), but you never
explicitly call it yourself. It's a "hook" into the GUI toolkit, provided
for you by the designers of the toolkit.

---J

--
--- remove zees if contacting via email ---

Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.