예제 #1
0
 /// <summary>
 /// Unregisters a hot key. If it fails, it will throw a <see cref="HotKeyException"/>
 /// </summary>
 /// <exception cref="HotKeyException">If hotKey removal failed</exception>
 public void UnregisterHotKey()
 {
     if (!WindowsFunctions.UnregisterHotKey(IntPtr.Zero, Id))
     {
         ErrorMsg = new Win32Exception(Marshal.GetLastWin32Error()).Message;
         throw new HotKeyException(ErrorMsg);
     }
 }
예제 #2
0
        /// <summary>
        /// Dispose unmanaged resources
        /// </summary>
        /// <param name="disposing"></param>
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                //dispose managed resources
            }

            //dispose unmanaged resources
            WindowsFunctions.UnregisterHotKey(IntPtr.Zero, Id);
            _disposed = true;
        }