ProcessCmdKey Question C# (500pts)

I am trying to trap all keydown and keyup events on a windows form in c#. I used the following code which works PERFECT for keydown events, but doesn't seem to fire at all for keyup events:

if (msg.Msg == WM_KEYDOWN)
    this.Text = "Keydown";
else if (msg.Msg == WM_KEYUP)
    this.Text = "KeyUp";

And the keydown always fires fine, and the keyup never fires. I tried putting breakpoints in to verify and the keyup is simply never triggered. What am I doing wrong?
Who is Participating?
Miguel OzConnect With a Mentor Software EngineerCommented:
Where are you calling this code?
Are you trying to simulate KeyDown and KeyUp events?
this functionality is alarady in the framework. Check:
Shahan AyyubSenior Software Engineer - iOSCommented:
Could you plz post your more code ??? Kindly clearify which object is reffering by 'msg'.
Pretzel_JesusAuthor Commented:
Received answer elsewhere. Let from site provided.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.