• Log in or sign up for an account here: https://www.sythe.org/login

[Dll] Flaming Hotkeys, Really simple to use

Flaming Idiots

Active Member

Visual Basic Programmers
Joined
Dec 22, 2005
Sythe Gold
0
Messages
235
Age
36
Location
Alberta Canada
Two Factor Authentication User
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:
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
To Enabled/Disable a hotkey, you just need to do the following:
Code:
Hotkeys.Hotkeys("Help").Enabled = False
You can also do more a more advanced way of making the hotkeys figure out if they are enabled like this:
Code:
Hotkeys.Hotkeys("Help").Enabled = BooleanExpression.Function(Function() Me.ContainsFocus)
' This will make the Help hotkey only work if it the form has focus.
FInally, you must specify a Modifier key (Alt, Control, Shift) unless they key is an F key, Pause or Escape.
 

Attachments

Thank you very much for this. I haven't actually looked at the script, or fooled around with the coding yet, but it seems very nice.

I'm intermediate in VB programming, and this should add maneuverability and ease to my programs. Once again, thank you very much.
 
What method do you use in your DLL to implement hotkeys? Not GetAsyncKeyState on a timer I hope...
 
Runescape Gamblingrunescape gambling
Back
Top