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?
Pretzel_JesusAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shahan AyyubSenior Software EngineerCommented:
Could you plz post your more code ??? Kindly clearify which object is reffering by 'msg'.
0
Miguel OzSoftware EngineerCommented:
Where are you calling this code?
Are you trying to simulate KeyDown and KeyUp events?
this functionality is alarady in the framework. Check:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.keyup.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pretzel_JesusAuthor Commented:
Received answer elsewhere. Let from site provided.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.