Queue hooks are called before system hooks.
This function installs the hook at the head of either the system or queue chain. The most recently installed hook is called first.
Use the WinQueryWindowULong function to obtain the queue handle associated with a window handle.