I really hate how Windows normally handles hotkeys, so I decided to make my own way for it.
To use it add a reference to "Flaming Hotkeys.dll".
Then you will need to create subs which do whatever you want the hotkeys to do, tag them with an attribute (Which you use to set the keys and name), and tell it to find the hotkeys.
Here is an example:
To Enabled/Disable a hotkey, you just need to do the following:
You can also do more a more advanced way of making the hotkeys figure out if they are enabled like this:
FInally, you must specify a Modifier key (Alt, Control, Shift) unless they key is an F key, Pause or Escape.
To use it add a reference to "Flaming Hotkeys.dll".
Then you will need to create subs which do whatever you want the hotkeys to do, tag them with an attribute (Which you use to set the keys and name), and tell it to find the hotkeys.
Here is an example:
Code:
Imports Flaming.Hotkeys
Public Class MainWindow
Private Sub MainWindow_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Hotkeys.FindHotkeys(Me)
End Sub
<HotKey("Help", ModKeys.None, Keys.F1)> _
Public Sub Help()
Static Count As Integer = 0
Count += 1
Me.Text = String.Format("F1 Pressed {0} Times", Count)
End Sub
<HotKey("Hide/Show", ModKeys.None, Keys.Escape)> _
Public Sub HideShow()
Me.Visible = Not Me.Visible
End Sub
End Class
Code:
Hotkeys.Hotkeys("Help").Enabled = False
Code:
Hotkeys.Hotkeys("Help").Enabled = BooleanExpression.Function(Function() Me.ContainsFocus)
' This will make the Help hotkey only work if it the form has focus.



