Beispiel #1
0
            protected override IntPtr WNDPROC(IntPtr hWnd, WM msg, IntPtr wParam, IntPtr lParam)
            {
                switch (msg)
                {
                case WM.GETTEXTLENGTH:
                    string?text = BeforeGetTextLengthCallback?.Invoke();
                    if (text != null)
                    {
                        SetWindowTextW(hWnd, text);
                    }

                    break;

                case WM.GETTEXT:
                    text = BeforeGetTextCallback?.Invoke();
                    if (text != null)
                    {
                        SetWindowTextW(hWnd, text);
                    }

                    break;
                }

                return(base.WNDPROC(hWnd, msg, wParam, lParam));
            }
            protected override void WndProc(ref Message m)
            {
                if (m.Msg == WindowMessages.WM_GETTEXTLENGTH)
                {
                    string text = BeforeGetTextLengthCallback?.Invoke();
                    if (text != null)
                    {
                        SetWindowTextW(m.HWnd, text);
                    }
                }
                else if (m.Msg == WindowMessages.WM_GETTEXT)
                {
                    string text = BeforeGetTextCallback?.Invoke();
                    if (text != null)
                    {
                        SetWindowTextW(m.HWnd, text);
                    }
                }

                base.WndProc(ref m);
            }