示例#1
0
            public void Unhook()
            {
                IntPtr handle = this.control.Handle;

                if (handle == IntPtr.Zero)
                {
                    throw new InvalidOperationException("Handle for control has not been created");
                }
                Win32.SetWindowLong(handle, -4, this.oldWndProc);
            }
示例#2
0
            public void SetHook()
            {
                IntPtr handle = this.control.Handle;

                if (handle == IntPtr.Zero)
                {
                    throw new InvalidOperationException("Handle for control has not been created");
                }
                this.oldWndProc = Win32.SetWindowLong(handle, -4, Marshal.GetFunctionPointerForDelegate(this.newWndProc));
            }
        private void OhneFocus()
        {
            const int WS_EX_NOACTIVATE = 0x08000000;
            const int GWL_EXSTYLE      = -20;

            try
            {
                IntPtr handle = this.Handle;
                if (handle == IntPtr.Zero)
                {
                    throw new InvalidOperationException("Handle for control has not been created");
                }

                Win32.SetWindowLong(handle, GWL_EXSTYLE, WS_EX_NOACTIVATE);
            }
            catch (Exception)
            {
                throw;
            }
        }