CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2005
    Posts
    7

    What are Hooks in software terms

    I keep hearing the term hooks, used in software, and I was wondering if someone could explain the concept behind hooks to me?

  2. #2
    Join Date
    May 2005
    Posts
    4,954

    Re: What are Hooks in software terms

    under windows OS you can read here:
    Hooks

    Cheers
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

  3. #3
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: What are Hooks in software terms

    Quote Originally Posted by davejohnston83
    I keep hearing the term hooks, used in software, and I was wondering if someone could explain the concept behind hooks to me?
    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++).

    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.

  4. #4
    Join Date
    Sep 2005
    Posts
    7

    Re: What are Hooks in software terms

    Thats great guys, thanks - another question cleared up.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured