If application A calls SetWindowsHookEx() to insert a low-level mouse hook (WH_MOUSE_LL) and application B does the same afterwards, which will receive a message first?
The behavior is documented under Hooks Overview:
The SetWindowsHookEx function always installs a hook procedure at the beginning of a hook chain. When an event occurs that is monitored by a particular type of hook, the system calls the procedure at the beginning of the hook chain associated with the hook. Each hook procedure in the chain determines whether to pass the event to the next procedure. A hook procedure passes an event to the next procedure by calling the CallNextHookEx function.
In your example, hook B will receive the message first, because it was installed most recent.