Esempio n. 1
0
 /// <summary>
 /// Unregisters a hot key from the system.
 /// </summary>
 /// <param name="keys">The keys that are associated with the hot key.</param>
 public void UnregisterHotKey(Keys hotKey)
 {
     lock (syncRoot) {
         if (!this.registredKeys.ContainsKey(hotKey))
         {
             throw new ArgumentException("Specified hot key is not registered.");
         }
         int id = this.registredKeys[hotKey];
         User32Interop.UnregisterHotKey(window.Handle, id);
         this.registredKeys.Remove(hotKey);
     }
 }
Esempio n. 2
0
 private void Dispose(bool disposing)
 {
     // Check to see if Dispose has already been called.
     if (!this.disposed)
     {
         // If disposing equals true, dispose all managed
         // and unmanaged resources.
         if (disposing)
         {
             // unregister all the registered hot keys.
             foreach (var item in this.registredKeys)
             {
                 User32Interop.UnregisterHotKey(window.Handle, item.Value);
             }
             this.registredKeys.Clear();
             // dispose the inner native window.
             window.Dispose();
         }
         // Note disposing has been done.
         disposed = true;
     }
 }