/// <summary>
 /// Adds a message filter to a window.
 /// </summary>
 /// <param name="hwnd">The handle of the window.</param>
 /// <param name="messageFilter">The message filter.</param>
 public static void AddMessageFilter(IntPtr hwnd, IMessageFilter messageFilter)
 {
     lock (RegisteredHooks)
     {
         hwnd = GetSafeWindowHandle(hwnd);
         MessageFilterHook hook;
         if (!RegisteredHooks.TryGetValue(hwnd, out hook))
         {
             hook = new MessageFilterHook(hwnd);
             RegisteredHooks.Add(hwnd, hook);
         }
         hook.AddMessageMilter(messageFilter);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Adds a message filter to a window.
 /// </summary>
 /// <param name="hwnd">The handle of the window.</param>
 /// <param name="messageFilter">The message filter.</param>
 public static void AddMessageFilter(IntPtr hwnd, IMessageFilter messageFilter)
 {
     lock (RegisteredHooks)
     {
         hwnd = GetSafeWindowHandle(hwnd);
         MessageFilterHook hook;
         if (!RegisteredHooks.TryGetValue(hwnd, out hook))
         {
             hook = new MessageFilterHook(hwnd);
             RegisteredHooks.Add(hwnd, hook);
         }
         hook.AddMessageMilter(messageFilter);
     }
 }