CTreeView tab key beeping problem

I have a class derived from CTreeView, and I want the user to be able to use the tab key and shift-tab to perform actions.  My class has an OnKeyDown function responding to a TVN_KEYDOWN message.  I have two problems:

1.  When the tab key is pressed, the application executes the code in the OnKeyDown switch statement properly, but then it beeps (apparently the default behavior for an undefined key in CTreeCtrl).  Setting *pResult to TRUE has no effect.

2.  I don't see any way to distinguish between the tab key and the shift-tab key.  They both return the same key codes.

I have tried using a function responding to WM_KEYDOWN instead of TVN_KEYDOWN, but the problems are the same.  Any help is appreciated.
DougBellAsked:
Who is Participating?
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.

PIGCommented:
I make test with Your problems. If I set *pResult = 1 no default implementation used.
For Your second question. When You down SHIFT You recive notification with wVKey = 0x0010 and later recive wVKey = 0x0009. I think that You can make owner flag for entry with SHIFT key presed.
If You give some more information ... I don't now. I think than ave not a problem.
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
PIGCommented:
BTW Chwck All Your exit paths. There can to be a problem with Beep.
0
DougBellAuthor Commented:
You were right about the beep stopping when *pResult = 1.  I must have had something else wrong when I tried it.

For the tab key, I'm aware that the shift key returns a code (it's 16, not 10).  The problem is telling when it's down.  I have implemented a flag variable that is set to TRUE by OnKeyDown and to FALSE by OnKeyUp.  It is also set to FALSE by OnKillFocus, in case the key is still down when the view loses focus.  The results still aren't exactly right, though, since shift-tab is read as tab if the shift key is down when the view gains focus.
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
System Programming

From novice to tech pro — start learning today.