COM Addin menu shortcut are being swallowed by MS Project

J

Jim Black

I have built a COM Addin using VS2005 that can be hosted by either Microsoft
Office Excel or Microsoft Office Project. Whether the addin is launched
from Project or Excel, it shows exactly the same form to the user, and this
form has a menu with lots of shortcuts defined for its menu items. When
hosted by Excel, these shortcuts work. For example, pressing CTRL+S fires my
form's file-save event handler as expected. For the Project addin, however,
pressing CTRL+S does not fire my form's event handler. I suspect that
somehow MS Project is intercepting these keystrokes whereas Excel is not.
The problem happens regardless of whether the addin is hosted in Project 2003
or Project 2007. How can I diagnose why these keystrokes are not being
passed to my addin for Microsoft Project?


--- Jim Black
 
A

Andrei Smolin [Add-in Express]

Jim,

You will have to use Spy++ to find the reason and a lot of Win32 API
programming to bypass this. But the easiest way is to use modal forms. Note
that Excel isn't as clean as you think: when you enter a key combination
that is recognized by Excel, it might switch the focus onto itself. We
discovered this when developing our custom panes for Excel 2000-2007.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
www.add-in-express.com
 
A

Andrei Smolin [Add-in Express]

Jim,

You will have to use Spy++ to find the reason and a lot of Win32 API
programming to bypass this. But the easiest way is to use modal forms. Note
that Excel isn't as clean as you think: when you enter a key combination
that is recognized by Excel, it might switch the focus onto itself. We
discovered this when developing our custom panes for Excel 2000-2007.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
www.add-in-express.com
 
J

Jim Black

Andrei,
Thanks for the information. I didn't realize that WindowsForm.ShowModal as
opposed to WindowsForm.Show might make a big difference for that Add-In
behavior. I'll look into that and see if that change is safe and effective!

--- Jim Black
 
J

Jim Black

I have tested your suggestion and it works. Thanks for the help! Operating
the application as a modal form unfortunately removes some nice workflows
that our users depend upon, so I still need to figure out a way to have it
work as a non-modal form. I'm not averse to jumping into Spy++ and doing
some Windows stuff, since the app is already wrapped in a C++ COM Shim.
Can you point me to a MSDN or other reference on this topic?
--- Jim Black
 

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