Giter VIP home page Giter VIP logo

Comments (7)

Ashlanfox avatar Ashlanfox commented on May 25, 2024 2

Interesting... Will need take a look at this.

False alarm, the mistake was on my side...

As the User32 functions (RegisterHotKey and UnregisterHotKey) are called using the this as the handle, I had to Invoke on the UI thread everytime I call one of your method that relies on those windows API functions. I forgot to do that for the suspend() and resume() calls. (which resulted in a silent ignore).

You should consider catching bool return value from HotkeyCore.UnregisterKey and HotkeyCore.RegisterKey for such cases. Maybe, if I'm actually doing it correctly, point the use of Invoke if calls are performed on background threads (maybe as a note in the README?).

Sorry again for the false alarm...
I truely love this project and the work you've done here, you're gold !

from hotkeylistener.

Willy-Kimura avatar Willy-Kimura commented on May 25, 2024 1

I'll definitely consider adding suspension of specific hotkeys.
For now however, try removing then re-adding a hotkey when needed.

You can also temporarily update a hotkey to another key then re-update to the original key after an action has taken place.

from hotkeylistener.

Ashlanfox avatar Ashlanfox commented on May 25, 2024 1

I'll definitely consider adding suspension of specific hotkeys.
For now however, try removing then re-adding a hotkey when needed.

You can also temporarily update a hotkey to another key then re-update to the original key after an action has taken place.

Lovely !

By the way it seems like when hotkeys are suspended and a WndProc(ref Message m) is called just afterwards, if the key is an old one then an exception occurs because it tries to access an element in the dictionary that does not exist anymore : 'System.Collections.Generic.KeyNotFoundException' (see Hotkey = HotkeyListener.Convert(this.Hotkeys[m.WParam.ToInt32()])).

from hotkeylistener.

Willy-Kimura avatar Willy-Kimura commented on May 25, 2024 1

Checkout the latest release v1.4.0.

from hotkeylistener.

Willy-Kimura avatar Willy-Kimura commented on May 25, 2024

In that case, you can use HotkeyListener's Suspend([hotkey]) method. This will allow you to suspend any specific hotkey and later on resume using it by calling the method Resume([hotkey]).

from hotkeylistener.

Ashlanfox avatar Ashlanfox commented on May 25, 2024

In that case, you can use HotkeyListener's Suspend([hotkey]) method. This will allow you to suspend any specific hotkey and later on resume using it by calling the method Resume([hotkey]).

I have thought of using this logic (much better than an aggressive SendKeys) but Resume() and Suspend() only perform on all Hotkeys (and not specific). I could create a listener for each Hotkey but this seems a bit overkill.

from hotkeylistener.

Willy-Kimura avatar Willy-Kimura commented on May 25, 2024

Interesting... Will need take a look at this.

from hotkeylistener.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.