} //Message loop that detects the hotkey private void GlobalHotkeyListener_FormClosing(object sender, FormClosingEventArgs e) {//Unregisters the hotkey and hides the tray icon if (queryHandler != null) { queryHandler.Dispose(); } if (processDetector != null) { processDetector.Dispose(); } UnRegisterTriggerKey(); if (trayIcon != null) { trayIcon.Dispose(); } }