Reputation: 817
I am building an Outlook add-in which exposes a custom task pane. From this pane upon some user actions,
Everything is good, except for the fact that Outlook chews away Delete / Back / Tab keys (and I'm sure that there are more), from being passed on to the control.
Inside this UserControl, I launch an internal site which requires the user to perform login. The WebBrowser accepts regular input, but does nothing when Tab / Delete / Back keys are pressed!
I am at my wits ends! I have been searching the net for a couple of weeks now and don't seem to know what is going on.
Does anybody know what is going on here and how to fix it? I have implemented a low-level keyboard hook and am able to trap the required keys. I have tried using User32.PostMessage but still no luck.
Thanks, Harsha
p.s.: I come from a Java background and so I'm somewhat of a novice when it comes to .NET & P/Invoke.
Upvotes: 2
Views: 853
Reputation: 15281
The WebBrowser control responds to the WM_GETDLGCODE message with DLGC_WANTARROWS | DLGC_WANTCHARS. That's why it won't handle certain keys such as Tab, Back and Delete. It told the parent to not handle those keys.
You can write a windows hook then call the webbrowser control's IOleInPlaceActiveObject ::TranslateAccelerator implementation.
Check "WebBrowser Keystroke Problems" by Scott Roberts, Microsoft Internet Developer April 1999 for more details.
Upvotes: 2