-
Jul 25th, 2013, 06:49 PM
#1
Thread Starter
New Member
Multi Key Hotkeys
Hello,
I am working on a program and need to be able to use Multi-Key hotkeys to activate other forms w/in the same solution. Below is the bit of code that I am currently trying to use.
Code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.ControlKey And Keys.NumPad1 Then
GaleOpening.Show()
End If
End Sub
When running this, pressing the control key activates the form, but I need the key combination of CTRL+Numpad1 to activate the form, and not just the control key. I have also tried wrapping the 2 keys in () and that did not work either. Any help would be greatly appreciated.
Thanks in advance.
-
Jul 25th, 2013, 07:16 PM
#2
Re: Multi Key Hotkeys
try this:
Code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.Control AndAlso e.KeyCode = Keys.NumPad1 Then
'key combination pressed
End If
End Sub
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jul 25th, 2013, 07:17 PM
#3
Thread Starter
New Member
Re: Multi Key Hotkeys
Paul,
I was just about to update my post saying that I figured it out. That is exactly why I tried and it worked. Thank you for your assistance anyway, it is much appreciated. On a side note, is there a way to send a String of text that includes a variable when a button is clicked?
-
Jul 25th, 2013, 07:21 PM
#4
Re: Multi Key Hotkeys
how do you mean - send a string?
containing what + send to what?
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jul 25th, 2013, 07:23 PM
#5
Thread Starter
New Member
Re: Multi Key Hotkeys
I will be using it to send a predefined string of text that will include a variable that is input from the form that I am opening with the hotkey. I would like to send this to the active window where the cursor is, but not sure if that is a feasible option.
-
Jul 25th, 2013, 07:31 PM
#6
Re: Multi Key Hotkeys
yeah no problem as long as the cursor is in an editing control that has focus.
Code:
Dim myVariable As String = "*here*"
SendKeys.Send(String.Format("a simple string containing {0} a variable", myVariable))
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jul 25th, 2013, 07:39 PM
#7
Thread Starter
New Member
Re: Multi Key Hotkeys
Paul,
Thank you for your assistance sir, it it much appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|