Ejemplo n.º 1
0
        protected override bool HooksCallbackProc(int code, int wParam, IntPtr lParam)
        {
            //indicates if any of underlaing events set e.Handled flag
            bool handled = false;

            ChoCBTEventArgs e = ChoCBTEventArgs.New(wParam, lParam);

            switch (code)
            {
            case ChoUser32.HCBT_ACTIVATE:
                _activate.Raise(this, e);
                break;

            case ChoUser32.HCBT_CREATEWND:
                _createWindow.Raise(this, e);
                break;

            case ChoUser32.HCBT_DESTROYWND:
                _destroyWindow.Raise(this, e);
                break;

            case ChoUser32.HCBT_MINMAX:
                _minMax.Raise(this, e);
                break;

            case ChoUser32.HCBT_SETFOCUS:
                _setFocus.Raise(this, e);
                break;

            case ChoUser32.HCBT_SYSCOMMAND:
                _sysCommand.Raise(this, e);
                break;

            case ChoUser32.HCBT_QS:
                _QS.Raise(this, e);
                break;

            case ChoUser32.HCBT_KEYSKIPPED:
                _keySkipped.Raise(this, e);
                break;
            }

            return(e.Handled);
        }
Ejemplo n.º 2
0
        public static ChoCBTEventArgs New(int wParam, IntPtr lParam)
        {
            ChoCBTEventArgs e = new ChoCBTEventArgs();

            // Cache the window's class name
            StringBuilder sb1 = new StringBuilder();

            sb1.Capacity = 40;
            ChoCore32.GetClassName((IntPtr)wParam, sb1, 40);
            e.ClassName = sb1.ToString();

            // Cache the window's title bar
            StringBuilder sb2 = new StringBuilder();

            //sb2.Capacity = 256;
            //GetWindowText(m_hwnd, sb2, 256);
            //m_title = sb2.ToString();

            //// Cache the dialog flag
            //m_isDialog = (m_class == "#32770");

            return(e);
        }