Disabling command bar buttons fails in Context Menu

R

Richard Gran

Hi guys,

Pardon me for cross-posting as this might be the relevant forum.

I can't find relevant information from the web so have to post one.

I'm trying to disable the Reply/Reply All buttons from the Context Menu
but it keeps throwing an exception. The exception is 0x80004005 but the
error message is not really helpful "Unspecified error".

I managed to disable those buttons from the Actions Menu Bar and the
Standard toolbar but I'm hitting a brick wall with the Context Menu.

I'm thinking that I might be getting an "access denied" error with the
Context Menu. Anyone has idea if Microsoft Outlook is preventing this?


Cheers,
Richard
 
K

Ken Slovak - [MVP - Outlook]

What version of Outlook are you coding for, and what's the code? It's
impossible to say much of anything without any information.
 
R

Richard Gran

Hi Ken,

It is from Outlook 2000 and onwards using OOM.

For a summary of what I am doing, I'd like to disable the reply/reply
all buttons when our customize mail item form is selected from a certain
folder (eg. Sent Items folder).

The code that disables the buttons on the Actions Menu and Standard tool
bar resides on the SelectionChange event of Explorer and this works
really well.

While the, Context Menu, ideally, should be on the same event as well
but currently/initially resides on the OnUpdate event of the CommandBars
as this is were the Context Menu is created/updated.

I can add my own custom buttons/popup menus on the Context Menu and
disable/enable, hide/display my custom buttons but can't do these
operations on the built-in ones. Outlook seems to reject or won't allow
these operations.

I'm using VC++/ATL here.


Thanks,
Richard
 
K

Ken Slovak - [MVP - Outlook]

The OnUpdate() hack is the only way to access the context menus before
Outlook 2007, so that's what you have to use. Unfortunately it looks like
any attempt to access .Visible or .Enabled on the built-in buttons returns
an exception..
 
R

Richard Gran

This is what I'm afraid of. Now I have no choice but to find another
solution to our problem. I'll be dropping this en/disabling option.

It's just a mystery to me why Outlook won't allow me to en/disable the
built-in ones in the Context Menu when it allows me to do it in the
Actions Menu and Standard tool bar.

Anyways, thanks for the input.

Cheers,
Richard
 
K

Ken Slovak - [MVP - Outlook]

Well, in Outlook 2003 and earlier the use of OnUpdate() for context menu
hacking is just that, an unsupported hack. Once Outlook 2007 and later
become the normal standard for Outlook development then we can use the
context menu stuff and not have these problems. Of course that will be years
from now...
 

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