View Single Post
  #4  
Old August 28th 09, 08:07 PM posted to microsoft.public.outlook.program_addins
John Erickson[_2_]
external usenet poster
 
Posts: 27
Default Context Menu Question

That's what I'm attempting to do. I'm pretty sure my Unadvise is working
properly. Then I'm using the Delete method (in reverse item# order in case
Delete changes the item numbering as I'm traversing the controls collection).
Is the Office::CommandBarControl:elete method the proper way to remove the
buttons I added on the first context display? I'm asking because it doesn't
seem to actually remove the controls even though it succeeds. What's the real
meaning of the bool argument in that method? There's a method called
__NewEnum (or something to that effect) should I be using that or some other
call after the Deletes to rebuild the controls collection? It's just really
odd that the same code works fine in Outlook 2002 but doesn't in Outlook 2000.

John

"Ken Slovak - [MVP - Outlook]" wrote:

Most of the samples I've used or seen for that hack destroy the UI and
re-create it when OnUpdate() fires. Otherwise the button can go out of scope
and just sit there doing nothing. Look in the samples for a
CommandBar.Reset() call.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"John Erickson" wrote in message
...
I have some new info. I just started my testing on Outlook 2002 and my
context menu problem doesn't occur there. My 3 added buttons appear on the
context menu ALL the time. Not just the first time. I'm using the exact
same
code as I am for Outlook 2000. Any idea what is different in Outlook 2000
that's making my added buttons only appear the first time? Or better yet
any
ideas on a work around?

John

"John Erickson" wrote:

Hi,

I think I know what you are probably going to say to this, but I thought
I'd
give it a shot anyway. I read all the other messages about Context menus
and
how they are unsupport, but there's this hack. I've been trying to use
the
hack for my Outlook 2000 add-in, but I'm having a really strange problem.
I
track down the "Context Menu", then I find the CommandBarPopup on it that
I
want to add 3 buttons to. I'm able to do all that and my new buttons work
fine. I can click on them and my event gets triggered and everything is
wonderful. The thing I can't explain is that my new buttons work the
first
time the context menu is displayed, but 2nd and subsequent times my
buttons
are missing. When I look at the context menu collection on the 2nd and
subsequent attempts to bring it up, the controls I added to the context
menu
are still there. They're enabled, visible, have a height and a width, but
they just don't show up. I've attempted to use the Delete method on my
buttons and re-add them, but I can't seem to get that to work. The delete
doesn't seem to do anything. Is there some other call I need to make to
have
the delete method work? Anyone have a clue how to fix this? I'd be happy
to
share code on it, but it's somewhat lengthy.

John



Ads