-
Notifications
You must be signed in to change notification settings - Fork 56
Description
Hi,
I'm using a .NET 8.0-windows application and I’ve defined several custom global hotkeys using HotkeyManager. The hotkeys I’ve defined work fine. However, when my application is running, global keyboard shortcuts in Visual Studio (such as Ctrl+K+D for auto-formatting) stop working. As soon as I close my application, these Visual Studio shortcuts work again.
Here's a sample of how I’m registering hotkeys:
public static void InitHotKeys()
{
try
{
HotkeyManager.Current.AddOrReplace("OpenExcells", Keys.U | Keys.Control | Keys.Shift, (sender, e) => ListeleriGuncelle());
// Register Alt + Shift + A hotkey
HotkeyManager.Current.AddOrReplace("Open", Keys.A | Keys.Control | Keys.Shift, (sender, e) => IslemAc(IslemTipi.Kademeli));
HotkeyManager.Current.AddOrReplace("OpenSatissiz", Keys.S | Keys.Control | Keys.Shift, (sender, e) => IslemAc(IslemTipi.SatisYapma));
HotkeyManager.Current.AddOrReplace("GuncelleEmir", Keys.G | Keys.Control | Keys.Shift, (sender, e) => IslemAc(IslemTipi.EmirGuncelle));
HotkeyManager.Current.AddOrReplace("Stop", Keys.D | Keys.Control | Keys.Shift, (sender, e) => IslemiDurdur());
// Poizyon büyüklüğü hesapla
HotkeyManager.Current.AddOrReplace("PozHesap", Keys.H | Keys.Control | Keys.Shift, (sender, e) => PozisyonHesapla());
// Taramass ekle kaldır
HotkeyManager.Current.AddOrReplace("SwinTaramEkle", Keys.S | Keys.Control, (sender, e) => TaramayaEkleKaldir(true, TradeType.Swing));
HotkeyManager.Current.AddOrReplace("DayTaramEkle", Keys.D | Keys.Control, (sender, e) => TaramayaEkleKaldir(true, TradeType.Day));
HotkeyManager.Current.AddOrReplace("SwinTaramKald", Keys.S | Keys.Alt, (sender, e) => TaramayaEkleKaldir(false, TradeType.Swing));
HotkeyManager.Current.AddOrReplace("DayTaramKald", Keys.D | Keys.Alt, (sender, e) => TaramayaEkleKaldir(false, TradeType.Day));
HotkeyManager.Current.AddOrReplace("TarmaListeGuncele", Keys.T | Keys.Control, (sender, e) => TaramaListesiniGuncelle());
}
catch (Exception ex)
{
Debug.WriteLine($"Error registering hotkeys: {ex.Message}");
}
}I have not registered Ctrl+K+D or any similar combination that should interfere with Visual Studio. Still, these system-wide shortcuts do not work when my app is active.
Question:
Is there a way to register only my specific hotkeys and not block other unrelated global/system-level shortcuts like the ones used by Visual Studio? I only want the hotkeys I explicitly register to be handled by my app and all others to behave normally.
Thanks in advance!