What is a hook

Discussion in 'C++' started by Mohammad, Nov 8, 2003.

  1. Mohammad

    Mohammad Guest

    Can someone explain to me what a hook is?

    Does it has something to do with a debugger?

    Mohammad, Nov 8, 2003
    1. Advertisements

  2. Moonlit

    Moonlit Guest


    "Mohammad" <> wrote in message
    > 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.
    Moonlit, Nov 8, 2003
    1. Advertisements

  3. EventHelix.com, Nov 8, 2003
  4. Mohammad

    Mohammad Guest

    (EventHelix.com) wrote in message news:<>...
    > 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/RealtimeMantra/KeepItSimple.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?

    Mohammad, Nov 9, 2003
  5. Hook is a general term to refer to any code written in the name
    for future enhancement. That's all there is to it.

    EventStudio 2.0 - Generate Sequence Diagrams and Use Case Diagrams in PDF
    EventHelix.com, Nov 10, 2003
  6. 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.


    --- remove zees if contacting via email ---
    John Gabriele, Nov 11, 2003
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Pifer via .NET 247

    Hook JScript Client Events to Server Controls

    David Pifer via .NET 247, May 2, 2004, in forum: ASP .Net
    David Jessee
    May 2, 2004
  2. djc
  3. =?Utf-8?B?d2FsdGVy?=

    How to hook httpmodule and page event together?

    =?Utf-8?B?d2FsdGVy?=, Mar 30, 2006, in forum: ASP .Net
    Mar 31, 2006
  4. Thomas Weidenfeller

    Re: the hook problem

    Thomas Weidenfeller, Aug 12, 2003, in forum: Java
    Roedy Green
    Aug 12, 2003
  5. Vic

    JSP Shutdown hook

    Vic, Aug 14, 2003, in forum: Java
    Arne Solheim
    Aug 14, 2003