Linking is the mechanism by which an application can intercept events (e. G., news, mouse action and click). The function of intercepting a particular type of event is called the linkage process. The linkage process can operate on each event it receives and then modify or discard the event。
Some of the uses of the linkage include:
Attention
Linking tends to slow down the speed of the system, as they increase the amount of processing that the system must perform for each message. The linkage should be installed only when necessary and removed as soon as possible。
This section discusses the following:
The system supports many different types of linkages; each type provides access to different aspects of its message-processing mechanism. For example, an application can use a link to monitor the flow of information on mouse messages。
The system maintains a separate chain for each type of linkage. The chain is the list of points for the return function (known as the linkage process) defined for a special application. When there is information linked to a particular type of connection, the system transmits it to each of the linkage processes cited in the chain, one after the other. The action the hook process can execute depends on the type of hook involved. Some types of linkage process can only monitor messages; others can modify or stop the message process, thereby preventing them from reaching the next linkage process or target window。
In order to take advantage of a particular type of linkage, the developers provide a linkage process and use the setwindowshookex function to install it in the chain associated with the linkage. The linkage process must have the following syntax:
Lresut callback hookproc()
i don't know. Wfaram wparam,
lparam lparam
i'm not sure. Other organiser
/ policy event
i don't know. Return callnexthookex (null, ncode, wparam, lparam);
♪ i'm sorry ♪

Hookproc is the placeholder for the application to define the name。
Ncode parameter is the hook code used by a hook process to determine the action to be executed. The value of a peg depends on the type of peg; each type has its own peg code set. The values of the wparam and lparam parameters depend on the linkage code, but they usually contain information about messages sent or published。
Setwindowshookex always installs a hooking program at the beginning of the chain. When an event is monitored by a particular type of connection, the system calls for the linkage process at the beginning of the chain of connection. Each linkage process in the chain determines whether the event is transmitted to the next process. The linkage process passes the event to the next process by calling the callnexthookex function。
Please note that certain types of linkage can only monitor information. Whether or not a given process calls callnexthookex, the system sends messages to each linkage process。
The global link monitors and calls all threads in the same desktop. Linking to a thread only monitors information on a single thread. The global linkage process can be called in the context of any application that is located on the same desktop as the route to be called, so the process must be in a separate dll module. Linking processes specific to threads are only called in the context of the associated threads. If the application installs a hook process for one of its own threads, the hook process can be in the same module where the application code is located or in a dll. If the application installs a coupling process for a thread of a different application, it must be in the dll. For information, see dynamic-lInk library。
Attention
Only global linkages should be used for commissioning purposes; otherwise, use should be avoided. Global linkages undermine systemic performance and lead to conflicts with other applications that achieve the same type of global linkages。
Each type of linkage enables applications to monitor different aspects of the system's message-processing mechanisms. Available hooks are described below。
Wh callndproc and wh callndprocret
Use the wh callndproc link to wh callndprocret to monitor messages sent to windows. The system calls the wh callndproc link process before sending the message to the receiving window and calls the wh callndprocret link process after the message is processed by the window process。

The wh callndprocret link points the pointer to the cwpretstrut structure to the linkage process. The structure contains the return values during the message-processing window and the message parameters associated with the message. Subclassification windows do not apply to messages transmitted between processes。
See callwndproc and callwndretproc for more information。
The system calls the wh cbt connection process before the window is activated, created, destroyed, minimized, maximized, moved or resized; before the system command is completed; removes the mouse or keyboard event from the system message queue; sets the input focus; or syncs with the system message queue. The value determination system for the return of a linkage process allows or prevents one of these. The wh cbt link is used primarily for computer-based training (cbt) applications。
See the cbtproc callback function for details。
For information, see winevents。
The system calls the wh debug hook process first and then the hook process associated with any other hook in the system. This hook is used to determine whether the system is allowed to call hook processes associated with other types of hooks。
For more information, see the debugproc callback function。
Wh foregrounidle is linked to enable you to perform low-priority tasks when their front line is idle. The system calls wh foregrounddle when the prospective thread of the application is about to be idle。
See foreground idleproc for more information。
Wh getmsage links the application to monitor the information that is about to be returned from the getmessage or peekmessage functions. You can monitor mouse and keyboard input and other messages published in the message queue using wh getmsage。

For more information see the getmsgproc callback function。
Who journalplayback
Warning
From windows 11, journaling hooks api is not supported and will be deleted in future versions. It is therefore strongly recommended that the call be changed to sendinput textinput api。
Wh journalplayback links to enable applications to insert messages into the system message queue. You can use this link to play a series of mouse and keyboard events recorded earlier. The normal mouse and keyboard input will be disabled as long as the wh journalplayback is installed. Wh journalplayback is a global connection that cannot be used as a link specific to a thread。
Wh journalplayback returns the time-out value. This value tells the system how many milliseconds to wait before processing current messages from the playlink. This allows the linkage to control the timing of the events it plays。
For more information, see the journalplaybackproc callback function。
Warning
From windows 11, journaling hooks api is not supported and will be deleted in future versions. It is therefore strongly recommended that the call be changed to sendinput textinput api。
Use the wh journalrecord link to monitor and record input events. Usually, this link is used to record a series of mouse and keyboard events for later playtime. The wh journalrecord link is a global link that cannot be used as a link specific to a thread。

For more information, see the journalrecordproc callback function。
Wh keyboard ll to monitor keyboard input events that are about to be published in the online queue。
For more information, see the lowlevelkeyboardproc callback function。
The wh keyboard link enables the application to monitor the flow of wm keydown and the information that wm keyup is about to return from the getmessage or peekmessage functions. Wh keyboard can be used to monitor keyboard input into the message queue。
See the keyboardproc callback function for details。
Linking to wh moue ll allows you to monitor mouse input events that are about to be published in the online queue。
For more information, see the lowlevelmouseproc callback function。
The wh moue connection allows you to monitor mouse messages that are about to be returned by the getmessage or peekmessage functions. You can monitor mouse input sent to the message queue using the wh moue link。
For more information see the mouseproc callback function。
Wh msgfilter and wh sysmgfilter

Wh msgfilter and wh sysgfilter enable you to monitor news about to be processed by the menu, scrollbar, message box or dialogue box, and to test when other windows are activated when users press alt+tab or alt+esc. The wh msgfilter link only monitors messages transmitted in menus, scrollbars, message boxes or dialogue boxes created by applications that install linkage processes. Wh sysgmfilter links to monitor such information for all applications。
Wh msgfilter and wh sysgmfilter are linked to enable you to perform a message filter during the mode loop, which is equivalent to a filter completed in the main message loop. For example, applications typically check new messages in the main cycle between the time of retrieval of messages from the queue and the time of dispatch messages and perform special processing as required. However, during the mode cycle, the system retrieves and dispatches messages, while the application is not allowed to filter them in its main message cycle. If the application installs wh msgfilter or wh sysgfilter, the system calls the process during the mode cycle。
The application can be directly linked by calling the callmsgfilter function. By using this function, the application can filter messages with the same code during the mode cycle, as in the main message cycle. To this end, encapsulate the filtering during the wh msgfilter linkage and call callmsgfilter between the call to the getmessage and dispactmessage functions。
While (getmessage(&msg, (hwd)null, 0,0))
other organiser
if (! Callmsgfilter (&qmsg, 0))
dispatchmessage (&qmsg);
♪ i'm sorry ♪
Callmsgfilter's last parameter is passed directly to the linkage process; any value can be entered. The linkage process defines a constant (e. G. Msc mainloop) that can be used to determine where to call the process。
For more information, see the messageproc and sysmsgproc callback functions。
Shell applications can use wh shell to receive important notifications. When a shell application is about to activate and the top window is created or destroyed, the system will call the wh shell linkage process。
Please note that custom shell applications do not receive wh shell messages. Therefore, any application registered as default shell must call the systemsparametersinfo function before receiving wh shell messages. This function must be called using the spi setminizedmerics and minimizedmerics structures. Set the iarrange member of this structure to arw hide。
See the shellproc callback function for details。




