Handling hot-keys in outlook add-in

W

wes2

I need to capture hot keys in my add-in so the add-in performs the same
operation as it does when the equivilent button or menu item is selected. I
can catch some of the hotkeys using the outlook object model but in some
cases it appears I'm going to catch the hot-key event. Does anyone know how
to create a generic event handler inside an outlook add-in (as opposed to
using the outlook object events.) One barrier is that I can't get the HWND
form an inspector object.
Any ideas? Has anyone done this?

THanks!
 
K

Ken Slovak - [MVP - Outlook]

To get the hWnd of an Inspector you need to use a Win32 API call to
FindWindow(). You need to supply that call with the Inspector.Caption
property and the class name of the Inspector window. For an email using the
Outlook editor or other items types you use "rctrl_renwnd32" as the class
name, for WordMail windows you use "OpusApp" as the class name. That gets
you the hWnd of the Inspector window.

I've done Windows message handling where I subclass all Windows messages
directed at the Outlook windows for keypresses or mouse events, but only in
unmanaged code. I've never translated that into any managed code, so I can't
specifically help you there. You might want to try a different group for
questions about how to handle that sort of subclassing in managed code.
 
W

wes2

Thanks! This is a good start for me.

Ken Slovak - said:
To get the hWnd of an Inspector you need to use a Win32 API call to
FindWindow(). You need to supply that call with the Inspector.Caption
property and the class name of the Inspector window. For an email using the
Outlook editor or other items types you use "rctrl_renwnd32" as the class
name, for WordMail windows you use "OpusApp" as the class name. That gets
you the hWnd of the Inspector window.

I've done Windows message handling where I subclass all Windows messages
directed at the Outlook windows for keypresses or mouse events, but only in
unmanaged code. I've never translated that into any managed code, so I can't
specifically help you there. You might want to try a different group for
questions about how to handle that sort of subclassing in managed code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top