A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Multiple Toolbars being added/Multiple Buttons being added to Mail



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 11th 09, 09:34 PM posted to microsoft.public.outlook.program_addins
Matt
external usenet poster
 
Posts: 119
Default Multiple Toolbars being added/Multiple Buttons being added to Mail

Hello,

I am developing an outlook add-in which requires a single toolbar with a
single button being added to the MailEditor window. Upon debugging my project
the first time, the button is created and all is well. However, after closing
outlook and debugging again, a duplicate toolbar is added (with the button).
This continues to happen and toolbar after toolbar is added. I manually
remove the Add-In and restart Outlook and the buttons are still there, the
only way to remove them is by restarting my PC, and it just happens again.
How would I go about solving this problem?

Thanks
Ads
  #2  
Old May 11th 09, 10:29 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Multiple Toolbars being added/Multiple Buttons being added to Mail

Always make sure to set the UI you create as temporary, and then delete it
before the relevant Explorer or Inspector closes.

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


"Matt" wrote in message
...
Hello,

I am developing an outlook add-in which requires a single toolbar with a
single button being added to the MailEditor window. Upon debugging my
project
the first time, the button is created and all is well. However, after
closing
outlook and debugging again, a duplicate toolbar is added (with the
button).
This continues to happen and toolbar after toolbar is added. I manually
remove the Add-In and restart Outlook and the buttons are still there, the
only way to remove them is by restarting my PC, and it just happens again.
How would I go about solving this problem?

Thanks


  #3  
Old May 12th 09, 02:00 PM posted to microsoft.public.outlook.program_addins
Matt
external usenet poster
 
Posts: 119
Default Multiple Toolbars being added/Multiple Buttons being added to

I'm fairly new to Outlook programming, how do I do that?

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

Always make sure to set the UI you create as temporary, and then delete it
before the relevant Explorer or Inspector closes.

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


"Matt" wrote in message
...
Hello,

I am developing an outlook add-in which requires a single toolbar with a
single button being added to the MailEditor window. Upon debugging my
project
the first time, the button is created and all is well. However, after
closing
outlook and debugging again, a duplicate toolbar is added (with the
button).
This continues to happen and toolbar after toolbar is added. I manually
remove the Add-In and restart Outlook and the buttons are still there, the
only way to remove them is by restarting my PC, and it just happens again.
How would I go about solving this problem?

Thanks



  #4  
Old May 12th 09, 02:58 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Multiple Toolbars being added/Multiple Buttons being added to

The CommandBars.Add() method has a temporary argument, set it to True if you
create a new CommandBar object. The CommandBarControls.Add() method also has
that argument available when you add a new control to a CommandBar
(menu/toolbar). Also set that True.

That's generally enough, but if for some reason Outlook doesn't correctly
close or crashes a belt plus suspenders approach is to handle the
Inspector.Close() event on any Inspector you are adding UI to, and the
Explorer.Close() event on any Explorer you add UI to. In those event
handlers you get your references to the controls and commandbars you added
and call their Delete() method to delete them.

There's lots of sample code in various languages at www.outlookcode.com that
shows handling those Close() events and how to handle adding and removing
UI. Take a look there for samples in your language.

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


"Matt" wrote in message
...
I'm fairly new to Outlook programming, how do I do that?


  #5  
Old May 12th 09, 03:24 PM posted to microsoft.public.outlook.program_addins
Matt
external usenet poster
 
Posts: 119
Default Multiple Toolbars being added/Multiple Buttons being added to

My commandbar was set as temporary but the button was not. Is this way correct:

button_1 = CType(newToolBar.Controls.Add(1, 1, Nothing, Nothing, True),
Office.CommandBarButton)

?

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

The CommandBars.Add() method has a temporary argument, set it to True if you
create a new CommandBar object. The CommandBarControls.Add() method also has
that argument available when you add a new control to a CommandBar
(menu/toolbar). Also set that True.

That's generally enough, but if for some reason Outlook doesn't correctly
close or crashes a belt plus suspenders approach is to handle the
Inspector.Close() event on any Inspector you are adding UI to, and the
Explorer.Close() event on any Explorer you add UI to. In those event
handlers you get your references to the controls and commandbars you added
and call their Delete() method to delete them.

There's lots of sample code in various languages at www.outlookcode.com that
shows handling those Close() events and how to handle adding and removing
UI. Take a look there for samples in your language.

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


"Matt" wrote in message
...
I'm fairly new to Outlook programming, how do I do that?



  #6  
Old May 12th 09, 07:06 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Multiple Toolbars being added/Multiple Buttons being added to

For optional missing values use System.Reflection.Missing.Value instead of
using Nothing. I usually define a class or global _missing variable object
for that.

In general, unless you are using a built-in control it's usually better to
not specify the ID argument and to supply the missing value for that also.
So I'd code that as:

button_1 = CType(newToolBar.Controls.Add(1, _missing, _missing, _missing,
True),
Office.CommandBarButton)

Also, when you set the other properties of any button you create make sure
to always use a unique Tag property. That prevents the button Click() event
from firing as many times as you have open items (Inspectors) or open folder
views (Explorers). With a unique Tag the Click() will fire only in that one
Inspector or Explorer.

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


"Matt" wrote in message
...
My commandbar was set as temporary but the button was not. Is this way
correct:

button_1 = CType(newToolBar.Controls.Add(1, 1, Nothing, Nothing, True),
Office.CommandBarButton)

?


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 questions: date of appt added/who added it? Melissa Outlook - Calandaring 7 May 15th 09 02:37 PM
Custom Image added to CommandBar Buttons Andrew Add-ins for Outlook 2 November 26th 08 02:26 PM
Outlook2003 added an extra header into my mail ! Ôq@office Outlook - Installation 2 August 14th 07 07:50 PM
Outlook2003 added an extra header into my mail ! Ôq@office Outlook - General Queries 1 August 14th 07 03:12 AM
Can't see picture added to signature in new mail CorrinHaupt Outlook Express 3 October 11th 06 09:32 PM


All times are GMT +1. The time now is 09:22 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.