Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
VB
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
    ' let the base class process the message
    MyBase.WndProc(m)
    ' if this is a WM_HOTKEY message, notify the parent object
    Const WM_HOTKEY As Integer = &H312
    If (m.Msg = WM_HOTKEY) Then

       counter += 1
       lblCounter.Text = counter

    End If
End Sub
Posted
Updated 23-Jun-11 1:16am
v2
Comments
Sergey Alexandrovich Kryukov 22-Jun-11 18:59pm    
Forms? Tag it! Now, what's to problem?
--SA
faifai2 22-Jun-11 19:12pm    
what tag is it??
Sergey Alexandrovich Kryukov 22-Jun-11 22:52pm    
After "See more". Use "Improve answer", see text input "Tags", add ", Forms". I would like you to know it as next time you need to tag it, if you want experts to recognize your question by tags and eventually answer.
--SA
faifai2 23-Jun-11 7:16am    
thanks

1 solution

Is it a problem at all or not? Simply put a break point in this method and you will see what happens if you press a hot key, use other message parameters accordingly. The message structure is documented here: http://msdn.microsoft.com/en-us/library/ms646279(v=vs.85).aspx[^].

Any questions?

—SA
 
Share this answer
 
Comments
faifai2 22-Jun-11 19:12pm    
that's all problem.
i would like to detect user release the hot key which had created.
Sergey Alexandrovich Kryukov 22-Jun-11 22:50pm    
I don't understand where the problem is. Put a breakpoint and try to hit a hotkey. Does you code stop there? You have everything to do it.
--SA
faifai2 23-Jun-11 7:21am    
thanks. the code i asked have no problem. But when i hold my HotKey(let say 'F8'), it will not stop until i release F8.
So, i would like to find a solution that can prevent problem when i hold down F8.
hope you can understand :(
Sergey Alexandrovich Kryukov 24-Jun-11 19:08pm    
What not stop. You probably get events from auto-repeating keyboard event. You can devise different scenarios checking that the event is repeating and using only first occasion. One of the simplest -- process releasing key, not pressing -- it will come only once.
Any questions?
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900