public static void AddMessageFilter(IntPtr hwnd, IMessageFilter messageFilter) { lock (MessageFilterHook.RegisteredHooks) { hwnd = MessageFilterHook.GetSafeWindowHandle(hwnd); MessageFilterHook local_0; if (!MessageFilterHook.RegisteredHooks.TryGetValue(hwnd, out local_0)) { local_0 = new MessageFilterHook(hwnd); MessageFilterHook.RegisteredHooks.Add(hwnd, local_0); } local_0.AddMessageMilter(messageFilter); } }
public static void RemoveMessageFilter(IntPtr hwnd, IMessageFilter messageFilter) { lock (MessageFilterHook.RegisteredHooks) { hwnd = MessageFilterHook.GetSafeWindowHandle(hwnd); MessageFilterHook local_0; if (!MessageFilterHook.RegisteredHooks.TryGetValue(hwnd, out local_0)) { return; } local_0.RemoveMessageFilter(messageFilter); if (!local_0.isDisposed) { return; } MessageFilterHook.RegisteredHooks.Remove(hwnd); local_0.RestoreWndProc(); } }