You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HookProcedure.cs 2.1 KiB

8 kuukautta sitten
12345678910111213141516171819202122232425262728293031323334353637383940
  1. // This code is distributed under MIT license.
  2. // Copyright (c) 2015 George Mamaladze
  3. // See license.txt or https://mit-license.org/
  4. using System;
  5. namespace Gma.System.MouseKeyHook.WinApi
  6. {
  7. /// <summary>
  8. /// The CallWndProc hook procedure is an application-defined or library-defined callback
  9. /// function used with the SetWindowsHookEx function. The HOOKPROC type defines a pointer
  10. /// to this callback function. CallWndProc is a placeholder for the application-defined
  11. /// or library-defined function name.
  12. /// </summary>
  13. /// <param name="nCode">
  14. /// [in] Specifies whether the hook procedure must process the message.
  15. /// If nCode is HC_ACTION, the hook procedure must process the message.
  16. /// If nCode is less than zero, the hook procedure must pass the message to the
  17. /// CallNextHookEx function without further processing and must return the
  18. /// value returned by CallNextHookEx.
  19. /// </param>
  20. /// <param name="wParam">
  21. /// [in] Specifies whether the message was sent by the current thread.
  22. /// If the message was sent by the current thread, it is nonzero; otherwise, it is zero.
  23. /// </param>
  24. /// <param name="lParam">
  25. /// [in] Pointer to a CWPSTRUCT structure that contains details about the message.
  26. /// </param>
  27. /// <returns>
  28. /// If nCode is less than zero, the hook procedure must return the value returned by CallNextHookEx.
  29. /// If nCode is greater than or equal to zero, it is highly recommended that you call CallNextHookEx
  30. /// and return the value it returns; otherwise, other applications that have installed WH_CALLWNDPROC
  31. /// hooks will not receive hook notifications and may behave incorrectly as a result. If the hook
  32. /// procedure does not call CallNextHookEx, the return value should be zero.
  33. /// </returns>
  34. /// <remarks>
  35. /// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/callwndproc.asp
  36. /// </remarks>
  37. public delegate IntPtr HookProcedure(int nCode, IntPtr wParam, IntPtr lParam);
  38. }