Exemplo n.º 1
0
        static void UnsubscribeFromWindowActivationEvents()
        {
            if (windowActivationHookHandle == 0)
            {
                return;
            }
            int result = Win.UnhookWinEvent(windowActivationHookHandle);

            windowActivationHookHandle = 0;
            windowActivationDelegate   = null;
            HandleAnyErrors(result);
        }
Exemplo n.º 2
0
        static void SubscribeToWindowActivationEvents()
        {
            if (windowActivationHookHandle != 0)
            {
                return;
            }

            windowActivationDelegate   = WinEventProc;
            windowActivationHookHandle = Win.SetWinEventHook(Win.EVENT_SYSTEM_FOREGROUND, Win.EVENT_SYSTEM_FOREGROUND, IntPtr.Zero, windowActivationDelegate, 0, 0, Win.WINEVENT_OUTOFCONTEXT);

            HandleAnyErrors(windowActivationHookHandle);
        }