❔ Recording hotkeys
How do I write down user hotkeys to save? For example, you want to use the combination CTRL+G, how do I save this command line?
e.KeyDown
shows the last key.10 Replies
somewhere inside the namespace and then in your KeyPressed event, you want something likewhere keyNumber is the identifier for Ctrl or shift of whatever
full disclosure, I don't know why it needs the
& 0x8000
this will also probably give you Ctrl+Ctrl
but it's a start 🙂you mean like a hotkey that whenever you press it, it runs even if your application is minimized?
the problem with this is that you can miss it and have to keep looping
you can dll import this to create an actual hotkey
maybe you can find a wrapper for it on github
you receive a message in the message loop of your window if a registered hotkey is pressed
learn something new every day. Thanks 🙂
@Jester Thanks, mate. <a:revolving_hearts:970018936525578302> Can I import a DLL into C# and create an application so that it works without the DLL(from exe) or I still have to substitute it?
that function is in the user32 dll which is in system32 so every windows pc has it. you domt have to put it in your application or anything
DllImportAttribute Class (System.Runtime.InteropServices)
Indicates that the attributed method is exposed by an unmanaged dynamic-link library (DLL) as a static entry point.
this way you load the dll at runtime to be able to call the function, thats how things are done
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.