c# outlook vsto add-in with webbrowser control. How do I get a handle on the browser control and Send keystrokes to it?

Outlook does not pass through certain key stokes (backspace, ctrl-c etc) to the web browser control on my outlook vsto add-in pane. I have created a keyboard hook that works and I can intercept the back space for example but I have been unable to send the back space command to the web browser control. Here is my code that does NOT work...

SendMessage(webBrowser1.Handle.ToInt32(),
               WM_KEYDOWN, ((int)kbDllHookStruct.vkCode), 0);

Any ideas?
oberon99Asked:
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.

Roshan DavisCommented:
few options
- Can you try control.SendKeys("{BS}") ?
- Can you try PostMessage instead of SendMEssage?
- Is the Keyboard hook is holding the BackSpace are you sending? can you check it is passing back the value to the actual window after your hook logic?
0
oberon99Author Commented:
Thanks roshmon,
Okay so I have resolved this I think. Purely by accident whilst investigating.
This is an odd one and I've yet to do more testing but right now it is working.

On the add-in pane I created the events
 
  _PreviewKeyDown
  _KeyUp
  _KeyDown

by double clicking on these events via the property editor. This creates the stubs.
I put no code into these events (well initally I put in messageboxes to show me the keys pressed) and this seems to be what makes it work. I've taken out my keyboard hook as well.

So I dunno if this is a resolution or not but for now I'll take it.
Thanks
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
brianw2212Commented:
oberon99:
So how did this turn out? i have the same problem but i cannot catch  
 _PreviewKeyDown
  _KeyUp
  _KeyDown

without using low level hookup, even with low level hookup to catch the backspace key events, still cannot forward it to browser control to make it work.

I'd appreciate it if you can let me know how this was resolved in details?

Thanks
0
oberon99Author Commented:
No sorry this is still only working intermittantly.
You're not catching the events but instead just creating them via the property edtior (events for the webbowser control).
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
C#

From novice to tech pro — start learning today.