|
-
Jul 9th, 2004, 05:08 AM
#1
Thread Starter
New Member
how to activate Hot Keys with vb.net code?
Hi All,
vb.net , WinForm
I would like to fire ALT+P hot keys with the timer or a button..
any helps?
best regards
Krasimir
-
Jul 9th, 2004, 05:27 AM
#2
Hyperactive Member
Yes, assign the hotkey to the menuitem for printing.
eg. you have a main menu that contains a file menu with a submenu named print, assign the hotkey Alt P to the print submenu.
Revised: AltP is not an assignable shortcut, I don't know why but I'll see what I can find.
Last edited by CyberHawke; Jul 9th, 2004 at 05:31 AM.
Whadayamean it doesn't work....
It works fine on my machine!

-
Jul 9th, 2004, 07:01 AM
#3
Thread Starter
New Member
Thank you CyberHawke,
seems to be a dificult task with the timer event.
the timer will be activated on period of time and Alt+P should be activated somehow from Timer1_Tick Event..
best regards
Karsimir
-
Jul 9th, 2004, 07:12 AM
#4
Hyperactive Member
you should just call your print routine directly from the Timer_Tick event.
Whadayamean it doesn't work....
It works fine on my machine!

-
Jul 9th, 2004, 09:57 AM
#5
Thread Starter
New Member
the problem is that i do not need Alt+P for printing routine,
i would like to use also Alt+L for other wake up session
somehow should find code to activate keyboard with vb.net
best regards
Krasimir
-
Jul 9th, 2004, 09:25 PM
#6
Fanatic Member
this?
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Text = "The quick brown monkey jumps over the lazy dog."
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
KeyPreview = True
End Sub
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.Alt And e.KeyCode = Keys.P Then
Button1.PerfumeClick() 'Button1.PerformClick()
End If
End Sub
please inform me if i'm on the wrong thread. i'll delete this. thanx.
-
Jul 11th, 2004, 04:46 AM
#7
Hyperactive Member
Dear Kasimir, I'm not sure if this could be a useful suggestion (My english is really weak). If you need to fire a routine in your Tick event, you can set a flag in your button click event and you can run the appropriate routine testing flag in timer Tick event procedure. I've not understood why you can't use Alt+L as a direct shortcut, anyway if you want to use particular combinations (Ctrl+Shift+SpaceBar for example) to perform your shortcut, you can use the Brown Monkey's way, or you can directly set the Flag in place of Button1.PerformClick. Another suggestion....e.handled=true could be a useful idea.
Good job.
Live long and prosper (Mr. Spock)
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
|