Inheritance: System.EventArgs
コード例 #1
0
 protected void OnHookInvoked(HookEventArgs e)
 {
     if (HookInvoked != null)
     {
         HookInvoked(this, e);
     }
 }
コード例 #2
0
        // ************************************************************************

        // ************************************************************************
        // Default filter function
        protected int CoreHookProc(int code, IntPtr wParam, IntPtr lParam)
        {
            if (code < 0)
            {
                return(CallNextHookEx(m_hhook, code, wParam, lParam));
            }

            // Let clients determine what to do
            HookEventArgs e = new HookEventArgs( );

            e.HookCode = code;
            e.wParam   = wParam;
            e.lParam   = lParam;
            OnHookInvoked(e);

            // Yield to the next hook in the chain
            return(CallNextHookEx(m_hhook, code, wParam, lParam));
        }
コード例 #3
0
        // ************************************************************************


        // ************************************************************************
        // Handles the hook event
        private void CbtHookInvoked(object sender, HookEventArgs e)
        {
            CbtHookAction code   = (CbtHookAction)e.HookCode;
            IntPtr        wParam = e.wParam;
            IntPtr        lParam = e.lParam;

            // Handle hook events (only a few of available actions)
            switch (code)
            {
            case CbtHookAction.HCBT_CREATEWND:
                HandleCreateWndEvent(wParam, lParam);
                break;

            case CbtHookAction.HCBT_DESTROYWND:
                HandleDestroyWndEvent(wParam, lParam);
                break;

            case CbtHookAction.HCBT_ACTIVATE:
                HandleActivateEvent(wParam, lParam);
                break;
            }

            return;
        }
コード例 #4
0
 protected void OnHookInvoked( HookEventArgs e )
 {
     if ( HookInvoked != null )
         HookInvoked ( this, e );
 }
コード例 #5
0
        // ************************************************************************
        // ************************************************************************
        // Default filter function
        protected int CoreHookProc( int code, IntPtr wParam, IntPtr lParam )
        {
            if ( code < 0 )
                return CallNextHookEx ( m_hhook, code, wParam, lParam );

            // Let clients determine what to do
            HookEventArgs e = new HookEventArgs ( );
            e.HookCode = code;
            e.wParam = wParam;
            e.lParam = lParam;
            OnHookInvoked ( e );

            // Yield to the next hook in the chain
            return CallNextHookEx ( m_hhook, code, wParam, lParam );
        }
コード例 #6
0
        // ************************************************************************
        // ************************************************************************
        // Handles the hook event
        private void CbtHookInvoked( object sender, HookEventArgs e )
        {
            CbtHookAction code = (CbtHookAction)e.HookCode;
            IntPtr wParam = e.wParam;
            IntPtr lParam = e.lParam;

            // Handle hook events (only a few of available actions)
            switch ( code ) {
                case CbtHookAction.HCBT_CREATEWND:
                    HandleCreateWndEvent ( wParam, lParam );
                    break;
                case CbtHookAction.HCBT_DESTROYWND:
                    HandleDestroyWndEvent ( wParam, lParam );
                    break;
                case CbtHookAction.HCBT_ACTIVATE:
                    HandleActivateEvent ( wParam, lParam );
                    break;
            }

            return;
        }