What is meant by the term “hook” in programming?

前端 未结 12 2499
暖寄归人
暖寄归人 2020-12-07 06:56

I recently heard the term \"hook\" while talking to some people about a program I was writing. I\'m unsure exactly what this term implies although I inferred from the conve

12条回答
  •  时光说笑
    2020-12-07 07:21

    Oftentimes hooking refers to Win32 message hooking or the Linux/OSX equivalents, but more generically hooking is simply notifying another object/window/program/etc that you want to be notified when a specified action happens. For instance: Having all windows on the system notify you as they are about to close.

    As a general rule, hooking is somewhat hazardous since doing it without understanding how it affects the system can lead to instability or at the very leas unexpected behaviour. It can also be VERY useful in certain circumstances, thought. For instance: FRAPS uses it to determine which windows it should show it's FPS counter on.

提交回复
热议问题