Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Registering a Hook Function

Client applications receive WinEvents in a WinEventProc callback function. The actions performed by the callback function are defined by the application, but the syntax must be as specified in the prototype.

Before it can receive events, the function must be registered by calling SetWinEventHook. The client can call SetWinEventHook more than once to register different hook functions, or to set additional events for a previously registered hook function.

When calling SetWinEventHook the client specifies which events to receive and how to receive them. The client can choose to:

  • Receive all events or a specific set of events.
  • Receive events from all threads or from a specific thread.
  • Receive events from all processes or from a specific process.
  • Handle events in process or out of process.

When an event is generated that matches the specified criteria, the system calls the client's WinEventProc callback function (or "hook procedure"). The parameters that the hook function receives tell the client about the window, object, and possible child element that generated the event. A client uses these parameters in an object retrieval call, such as AccessibleObjectFromEvent.

 

 

Show:
© 2017 Microsoft