Ejemplo n.º 1
0
        private static void RemoveWndProcUsage(HwndHost hwndHost)
        {
            int refCount = (int)hwndHost.GetValue(WindowHookRefCountProperty);

            refCount--;
            hwndHost.SetValue(WindowHookRefCountProperty, refCount);

            if (refCount == 0)
            {
                HwndHostExtensionsWindowHook hook = (HwndHostExtensionsWindowHook)hwndHost.GetValue(WindowHookProperty);
                hook.Dispose();
                hwndHost.ClearValue(WindowHookProperty);
            }
        }
Ejemplo n.º 2
0
        private static bool TryHookWndProc(HwndHost hwndHost)
        {
            if (hwndHost.Handle != IntPtr.Zero)
            {
                // Hook the window messages so we can intercept the
                // various messages.
                HwndHostExtensionsWindowHook hook = new HwndHostExtensionsWindowHook(hwndHost);

                // Keep our hook alive.
                hwndHost.SetValue(WindowHookProperty, hook);

                return(true);
            }

            return(false);
        }
        private static bool TryHookWndProc(HwndHost hwndHost)
        {
            if (hwndHost.Handle != IntPtr.Zero)
            {
                // Hook the window messages so we can intercept the
                // various messages.
                HwndHostExtensionsWindowHook hook = new HwndHostExtensionsWindowHook(hwndHost);

                // Keep our hook alive.
                hwndHost.SetValue(WindowHookProperty, hook);

                return true;
            }
            else
            {
                return false;
            }
        }