Beispiel #1
0
 protected override void OnClosed(EventArgs e)
 {
     _source.RemoveHook(KeybindService.HwndHook);
     _source = null;
     KeybindService.UnregisterHotKey(helper);
     base.OnClosed(e);
 }
Beispiel #2
0
 protected override void OnSourceInitialized(EventArgs e)
 {
     base.OnSourceInitialized(e);
     helper  = new WindowInteropHelper(this);
     _source = HwndSource.FromHwnd(helper.Handle);
     _source.AddHook(KeybindService.HwndHook);
     KeybindService.RegisterHotKey(helper);
 }