Is there a way to detect only a special key (e.g. CONTROL), instead of detecting a combination of keys (e.g. CONTROL + A)?
I can't seem to find a way to do this in the documentation. I tried using combinations, here's the code:
var specialKeys = new Dictionary<Combination, Action>
{
{Combination.FromString("Control"), () => Debug.WriteLine("CTRL was pressed.")},
{Combination.TriggeredBy(Keys.Alt), () => Debug.WriteLine("ALT was pressed.")},
};
Hook.GlobalEvents().OnCombination(specialKeys);
But this doesn't work. It only works with actual combinations (e.g. "Control + U", TriggeredBy(Keys.Alt).With(Keys.U)). I also tried using sequences, but that doesn't work either and gives me a compile error, saying that it was "unable to cast object of type 'Sequence' to type 'Combination'.
Can anyone help me with this and let m know if there's a way to do this using this library? Thank you in advance.
Is there a way to detect only a special key (e.g. CONTROL), instead of detecting a combination of keys (e.g. CONTROL + A)?
I can't seem to find a way to do this in the documentation. I tried using combinations, here's the code:
But this doesn't work. It only works with actual combinations (e.g. "Control + U", TriggeredBy(Keys.Alt).With(Keys.U)). I also tried using sequences, but that doesn't work either and gives me a compile error, saying that it was "unable to cast object of type 'Sequence' to type 'Combination'.
Can anyone help me with this and let m know if there's a way to do this using this library? Thank you in advance.