Word as OL Editor and Context Menus

Add-in Express™ Support Service
That's what is more important than anything else

Word as OL Editor and Context Menus
 
Tomas Restrepo




Posts: 3
Joined: 2007-06-25
I've built an Outlook Add-In successfully using the .NET Add-In Express product, and everything works great. However, I am running into a bit of a curious problem and wondered if anyone else has seen it (didn't find anything like it on the forums).

Basically, we add a command bar button to the standard command bar on message inspectors, which works great. When the user clicks the button, we display a simple menu (a Windows Forms ContextMenuStrip). This works perfectly in read message inspectors (always) and on new message inspectors, as long as Word is not setup as the default mail editor in Outlook (this is Outlook 2003, btw)

What happens is that if word is the selected email editor, the menu tries to appear, but doesn't get drawn (a blank/non-painting region appears on the screen and doesn't go away). Obviously, the menu doesn't work and doesn't recognize clicks or go away until I kill both outlook.exe and word.exe.

After a bit of fiddling around, I realized the problem is that when the button click event is triggered on my add-in module, and word is the mail editor, the thread I get the event on has no message loop associated with it, so the context menu never processes window messages (including WM_DRAW).

Any idea why this might be so?
Posted 25 Jun, 2007 18:09:44 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Tomas.

Please try to use the OnSendMessage event handler to show the context menu in respond to your own message. To send a message you can use the SendMessage method of the addinmodule.
E.g. the message can be:
private const int WM_USER = 0x0400;
private const int WM_MYMESSAGES = WM_USER + 1000;


P.S. We always do our best to answer your forum requests as soon as possible. However, we apply the rule "first in first out" with Premium Support Service subscribers taking priority. Please understand it may take us some time to do research on the issue. Please be assured we will let you know as soon as the best possible solution is found.
Posted 26 Jun, 2007 13:39:31 Top
Tomas Restrepo




Posts: 3
Joined: 2007-06-25
Sergey,

Thanks for the answer; I think this will probably fix the issue (though took me a bit of time to figure out what you meant :)).

Anyway, I cannot quite test it yet. For some reason, now Word refuses to show my added buttons in the command bar (which worked fine before) anymore. In fact, it seems that somehow I messed up things so badly that when word launches as the email editor, it completely ignores my outlook add-in. For example, the InspectorActivate event doesn't fire anymore when I create a new message and word is set as the editor.

Any ideas on that one?
Posted 26 Jun, 2007 15:27:12 Top
Sergey Grischenko


Add-in Express team


Posts: 7187
Joined: 2004-07-05
Hi Tomas.

The InspectorActivate doesn't fire when you open an email in RTF format. But it should work properly when you compose a new email. Please send me an example that reproduces the issue. I will try to help.
Posted 27 Jun, 2007 08:26:45 Top
Tomas Restrepo




Posts: 3
Joined: 2007-06-25
Sergey,

Thanks, I just created an empty add-in, added an inspector command bar with a button on it (named the command bar "Standard", as I'm showing the standard command bar on my inspectors) and trapped the InspectorActivate Event. It still doesn't show the button or fire the event. Where do you want me to send you the sample?
Posted 28 Jun, 2007 13:22:03 Top
Andrei Smolin


Add-in Express team


Posts: 14106
Joined: 2006-05-11
Hi Thomas,

Please use our support e-mail address. YOu can find it in readme.txt.

Regards from Belarus,

Andrei Smolin
Add-in Express Team Leader
Posted 29 Jun, 2007 12:01:01 Top