Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
developer
active.documents
automation
binary.file_format
clipboard.dde
com.add_ins
hosting.controls
internet_other
office.sdks
officedev
officedev.other
outlook.forms
outlook.vba
smarttags
vba
web.components
  
 
date: Mon, 21 Jul 2008 11:03:17 +0100,    group: microsoft.public.office.developer.com.add_ins        back       


Removing button from Outlook on shutdown   
Hi there,

    I know this question has been asked many a time before, and I have 
actually read 90% of the replies regarding it, unfortunately no solution is 
working for me at the moment.

    I create the button on startup and keep a reference to the 
CommandBarControlPtr object.  On shutdown, rather than attempting to find 
the button again, I use that reference, which still has exactly the same 
address as it did when it was functioning, but for some reason or another 
the object is invalid.

    I therefore cannot remove the button from the toolbar.  I've tried in 
onBeginShutdown and onDisconnection, but it's not working anywhere, the 
second I touch the Delete method it freaks out.  I'm sure there must be some 
logical reasoning behind this, but everything I have tried upto this point 
has failed to help, the object seemingly falls out of scope.

    Any ideas on how I can resolve this?

Nick.
date: Mon, 21 Jul 2008 11:03:17 +0100   author:   Nick

Re: Removing button from Outlook on shutdown   
If you've read all the replies you already know the answer. Both of those 
events are too late and the buttons you created for the UI are already out 
of scope for Outlook at that time. You need to delete the UI you created 
earlier than that.

If this is an Explorer button you should be trapping the Explorer.Close() 
event and attempting to delete the UI there for that Explorer. You also 
should be creating the UI in the first place with the Temporary argument set 
to true.

-- 
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


"Nick"  wrote in message 
news:%239A6Akx6IHA.3856@TK2MSFTNGP06.phx.gbl...
> Hi there,
>
>    I know this question has been asked many a time before, and I have 
> actually read 90% of the replies regarding it, unfortunately no solution 
> is working for me at the moment.
>
>    I create the button on startup and keep a reference to the 
> CommandBarControlPtr object.  On shutdown, rather than attempting to find 
> the button again, I use that reference, which still has exactly the same 
> address as it did when it was functioning, but for some reason or another 
> the object is invalid.
>
>    I therefore cannot remove the button from the toolbar.  I've tried in 
> onBeginShutdown and onDisconnection, but it's not working anywhere, the 
> second I touch the Delete method it freaks out.  I'm sure there must be 
> some logical reasoning behind this, but everything I have tried upto this 
> point has failed to help, the object seemingly falls out of scope.
>
>    Any ideas on how I can resolve this?
>
> Nick.
>
date: Mon, 21 Jul 2008 09:24:08 -0400   author:   Ken Slovak - [MVP - Outlook]

Re: Removing button from Outlook on shutdown   
Hey Ken,

    Well strangely enough I hadn't come across that solution until about an 
hour ago.  I've implemented the close event although I don't think I've done 
it totally correct the button is now deleting as it should be.  I like the 
way Microsoft breaks it's own standards, fantastic.

    What I'm actually doing in the Invoke event is checking the first 
parameter to see if it = 61448 as this seemed to be the value around the 
close event.  You wouldn't happen to have any reference on the correct way 
to check to see if it is the close method or not would you?  Or is that the 
correct way?

    Thanks a million for your time it's most appreciated.

Nick.

"Ken Slovak - [MVP - Outlook]"  wrote in message 
news:%23OWteUz6IHA.3856@TK2MSFTNGP06.phx.gbl...
> If you've read all the replies you already know the answer. Both of those 
> events are too late and the buttons you created for the UI are already out 
> of scope for Outlook at that time. You need to delete the UI you created 
> earlier than that.
>
> If this is an Explorer button you should be trapping the Explorer.Close() 
> event and attempting to delete the UI there for that Explorer. You also 
> should be creating the UI in the first place with the Temporary argument 
> set to true.
>
> -- 
> 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
>
>
> "Nick"  wrote in message 
> news:%239A6Akx6IHA.3856@TK2MSFTNGP06.phx.gbl...
>> Hi there,
>>
>>    I know this question has been asked many a time before, and I have 
>> actually read 90% of the replies regarding it, unfortunately no solution 
>> is working for me at the moment.
>>
>>    I create the button on startup and keep a reference to the 
>> CommandBarControlPtr object.  On shutdown, rather than attempting to find 
>> the button again, I use that reference, which still has exactly the same 
>> address as it did when it was functioning, but for some reason or another 
>> the object is invalid.
>>
>>    I therefore cannot remove the button from the toolbar.  I've tried in 
>> onBeginShutdown and onDisconnection, but it's not working anywhere, the 
>> second I touch the Delete method it freaks out.  I'm sure there must be 
>> some logical reasoning behind this, but everything I have tried upto this 
>> point has failed to help, the object seemingly falls out of scope.
>>
>>    Any ideas on how I can resolve this?
>>
>> Nick.
>>
>
date: Mon, 21 Jul 2008 14:33:00 +0100   author:   Nick

Re: Removing button from Outlook on shutdown   
I have no idea what you're talking about related to = 61448. I don't do C++ 
code though.

In C# or any of the basic languages you subscribe to the Close event for the 
Explorer when the NewExplorer() event of the Explorers collection fires or 
for the initial Explorer you instantiate an instance of that on startup if 
Application.Explorers.Count > 0. That should provide an event that will fire 
when that Explorer is closing.

-- 
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


"Nick"  wrote in message 
news:OHbqNZz6IHA.4988@TK2MSFTNGP04.phx.gbl...
> Hey Ken,
>
>    Well strangely enough I hadn't come across that solution until about an 
> hour ago.  I've implemented the close event although I don't think I've 
> done it totally correct the button is now deleting as it should be.  I 
> like the way Microsoft breaks it's own standards, fantastic.
>
>    What I'm actually doing in the Invoke event is checking the first 
> parameter to see if it = 61448 as this seemed to be the value around the 
> close event.  You wouldn't happen to have any reference on the correct way 
> to check to see if it is the close method or not would you?  Or is that 
> the correct way?
>
>    Thanks a million for your time it's most appreciated.
>
> Nick.
date: Mon, 21 Jul 2008 10:15:18 -0400   author:   Ken Slovak - [MVP - Outlook]

Re: Removing button from Outlook on shutdown   
Hi Ken,

    Oh okay, it's just it's implemented a little different in C++, you have 
to use the IDispatch interface which fires all events through the same 
callback.  Everything seems to be working fine at the moment anyways so I'll 
just give it a thorough testing and with anyluck it can stay as is.

    Cheers anyway.

Nick.

"Ken Slovak - [MVP - Outlook]"  wrote in message 
news:ubFd6wz6IHA.3696@TK2MSFTNGP04.phx.gbl...
>I have no idea what you're talking about related to = 61448. I don't do C++ 
>code though.
>
> In C# or any of the basic languages you subscribe to the Close event for 
> the Explorer when the NewExplorer() event of the Explorers collection 
> fires or for the initial Explorer you instantiate an instance of that on 
> startup if Application.Explorers.Count > 0. That should provide an event 
> that will fire when that Explorer is closing.
>
> -- 
> 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
>
>
> "Nick"  wrote in message 
> news:OHbqNZz6IHA.4988@TK2MSFTNGP04.phx.gbl...
>> Hey Ken,
>>
>>    Well strangely enough I hadn't come across that solution until about 
>> an hour ago.  I've implemented the close event although I don't think 
>> I've done it totally correct the button is now deleting as it should be. 
>> I like the way Microsoft breaks it's own standards, fantastic.
>>
>>    What I'm actually doing in the Invoke event is checking the first 
>> parameter to see if it = 61448 as this seemed to be the value around the 
>> close event.  You wouldn't happen to have any reference on the correct 
>> way to check to see if it is the close method or not would you?  Or is 
>> that the correct way?
>>
>>    Thanks a million for your time it's most appreciated.
>>
>> Nick.
>
date: Mon, 21 Jul 2008 15:31:30 +0100   author:   Nick

Re: Removing button from Outlook on shutdown   
Hi Nick,

>    I create the button on startup and keep a reference to the
> CommandBarControlPtr object.  On shutdown, rather than attempting to
> find the button again, I use that reference, which still has exactly
> the same address as it did when it was functioning, but for some
> reason or another the object is invalid.

You can create command bar controls as temporary on a command bar.
So it is not persisted and you do not need to remove it.

See the temp parameter of the Add method.

--
SvenC
date: Sun, 27 Jul 2008 11:14:41 +0200   author:   SvenC am

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us