コード例 #1
0
            public override int SubClassProc(IntPtr hWnd, IntPtr msg, IntPtr wParam, IntPtr lParam, IntPtr uIdSubclass, IntPtr dwRefData)
            {
                switch ((uint)msg)
                {
                case (uint)WM.SIZE:
                    var args = new SubClassingWindowEventArgs(lParam);
                    if (!_closing)
                    {
                        OnCallBackEvent(args);
                    }
                    break;

                case (uint)WM.SETFOCUS:
                    if (!_closing)
                    {
                        User32.SendMessage(_vbeHwnd, WM.RUBBERDUCK_CHILD_FOCUS, Hwnd, Hwnd);
                    }
                    break;

                case (uint)WM.KILLFOCUS:
                    if (!_closing)
                    {
                        User32.SendMessage(_vbeHwnd, WM.RUBBERDUCK_CHILD_FOCUS, Hwnd, IntPtr.Zero);
                    }
                    break;

                case (uint)WM.RUBBERDUCK_SINKING:
                    OnCallBackEvent(new SubClassingWindowEventArgs(lParam)
                    {
                        Closing = true
                    });
                    _closing = true;
                    break;
                }
                return(base.SubClassProc(hWnd, msg, wParam, lParam, uIdSubclass, dwRefData));
            }