| View previous topic :: View next topic |
| Author |
Message |
Typhoon808 Expert Cheater
Reputation: 0
Joined: 27 Mar 2008 Posts: 175 Location: Wales
|
Posted: Mon Mar 31, 2008 3:18 am Post subject: |
|
|
| slovach wrote: | You actually have to have the form focused for that to work, as far as I know.
Using RegisterHotKey or GetAsyncKeyState won't cause such an issue |
JohnH from vbdotnetforums made a class which makes it able to use hotkeys outside of the focused form. I use it quite regulary.
The class it attatched to this post and you can add it to your form using "Add Existng Item". Once you have added it to your project, add this code to your main form.vb code:
| Code: | Private Sub frmDiv_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) _
Handles Me.FormClosed
hots.Unregister()
End Sub
Private Sub frmDiv_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
hots = New NSHotkey.Hotkeys(Me)
setuphotkeys()
End Sub
WithEvents hots As NSHotkey.Hotkeys
Sub setuphotkeys()
'Ctrl+J
hots.Add(New NSHotkey.HotKey("ctrlj", Keys.J, NSHotkey.HotkeyModifiers.MOD_CONTROL))
'Shift+H
hots.Add(New NSHotkey.HotKey("shifth", Keys.H, NSHotkey.HotkeyModifiers.MOD_SHIFT))
'Win+A
hots.Add(New NSHotkey.HotKey("wina", Keys.A, NSHotkey.HotkeyModifiers.MOD_WIN))
End Sub
Private Sub hots_Hotkey(ByVal e As NSHotkey.HotKeyEventArgs) Handles hots.Hotkey
MsgBox(e.Key.AtomString)
Select Case e.Key.AtomString
Case "ctrlj"
Case "shifth"
Case "wina"
End Select
End Sub |
That is just an example but you see where the cases are coming from. I hope this helps you and your future development.
|
|
| Back to top |
|
 |
shadowfox85 Grandmaster Cheater
Reputation: 0
Joined: 14 Oct 2006 Posts: 728 Location: Box of Shit
|
Posted: Mon Mar 31, 2008 8:55 am Post subject: |
|
|
| It may be impressive but people don't need ways to make themselves lazier.
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Mon Mar 31, 2008 10:22 am Post subject: |
|
|
| instead of registry, use ini files, much easier.
|
|
| Back to top |
|
 |
Deletion I post too much
Reputation: 0
Joined: 22 Jun 2006 Posts: 2148 Location: Underground
|
Posted: Mon Mar 31, 2008 3:24 pm Post subject: |
|
|
I use the right corner of my desktop for shortcuts like these. Nice make, but what makes your prog so special(No offense intended, I just want a reason to dl it =P)
_________________
Bitch, please.
| redslothx wrote: | | oh im a man so respect the penis powers |
|
|
| Back to top |
|
 |
t04glovern Advanced Cheater
Reputation: 0
Joined: 31 Mar 2008 Posts: 53 Location: Australia, Perth
|
Posted: Wed Apr 02, 2008 8:44 am Post subject: cool |
|
|
| cool this could be a cool way to save time, nice share
|
|
| Back to top |
|
 |
|