UnregisterHotKey() private method

private UnregisterHotKey ( IntPtr hWnd, int id ) : int
hWnd System.IntPtr
id int
return int
Beispiel #1
0
        public bool Unregister()
        {
            // Check that we have registered
            if (!this.registered)
            {
                throw new NotSupportedException("You cannot unregister a hotkey that is not registered");
            }

            // Clean up after ourselves
            bool result = (Hotkey.UnregisterHotKey(this.windowControl.Handle, this.id) != 0);

            // Clear the control reference and register state
            this.registered    = false;
            this.windowControl = null;

            return(result);
        }
Beispiel #2
0
        public void Unregister()
        {
            // Check that we have registered
            if (!this.registered)
            {
                throw new NotSupportedException("You cannot unregister a hotkey that is not registered");
            }

            // It's possible that the control itself has died: in that case, no need to unregister!
            if (!this.windowControl.IsDisposed)
            {
                // Clean up after ourselves
                if (Hotkey.UnregisterHotKey(this.windowControl.Handle, this.id) == 0)
                {
                    throw new Win32Exception();
                }
            }

            // Clear the control reference and register state
            this.registered    = false;
            this.windowControl = null;
        }