![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I am just starting learning to program add-in in C#. I went through a simple
tutorial that just added a button to the standard toolbar and when clicked had a popup saying "Hello World". When I go to uninstall the add-in through Visual Studio 2005 and open Outlook up, the button is still there but doesn't do anything when clicked. When I try to go into the Advanced Options to see if it is still registered as a Com Addin, it isn't. The big problem is that everytime I install the control, I get another button added to the toolbar. So right now I have 6. I looked in the registery under both hklm and the one for the current user but don't see any reference to this add-in. Below is the code I use to build the control and to then delete it. Any ideas on how to get rid of all those extra buttons? public void OnStartupComplete(ref System.Array custom) { CommandBars commandBars = applicationObject.ActiveExplorer().CommandBars; try { this.toolbarButton = (CommandBarButton)commandBars["Standard"].Controls["AddSave"]; } catch (System.Exception) { this.toolbarButton = (CommandBarButton)commandBars["Standard"].Controls.Add(1, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value); this.toolbarButton.Caption = "Add/Save"; this.toolbarButton.Style = MsoButtonStyle.msoButtonCaption; } this.toolbarButton.Tag = "AddSave"; this.toolbarButton.OnAction = "!RecordEmail.Connect"; this.toolbarButton.Visible = true; this.toolbarButton.Click += new _CommandBarButtonEvents_ClickEventHandler(this.OnT oolbarButtonClick); } Below I try 2 ways to delete the item: public void OnBeginShutdown(ref System.Array custom) { CommandBars commandBars = applicationObject.ActiveExplorer().CommandBars; try { commandBars["Standard"].Controls["AddSave"].Delete(System.Reflection.Missing.Value); } catch { } object omissing = System.Reflection.Missing.Value; this.toolbarButton.Delete(omissing); this.toolbarButton = null; } -- Thanks Royal |
Ads |
#2
|
|||
|
|||
![]()
By the time the shutdown code has fired the event the buttons are out of
scope. You should handle the Explorer.Close event and delete your buttons there. You also should use the Temporary argument and set it true when you create the buttons. To get rid of the existing ones, which will persist forever even without your addin there since they were added permanently follow these steps. Right-click on the toolbar and select Customize. Drag the orphaned buttons off of the toolbar. Exit Customize mode. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "RoyalHale" wrote in message ... I am just starting learning to program add-in in C#. I went through a simple tutorial that just added a button to the standard toolbar and when clicked had a popup saying "Hello World". When I go to uninstall the add-in through Visual Studio 2005 and open Outlook up, the button is still there but doesn't do anything when clicked. When I try to go into the Advanced Options to see if it is still registered as a Com Addin, it isn't. The big problem is that everytime I install the control, I get another button added to the toolbar. So right now I have 6. I looked in the registery under both hklm and the one for the current user but don't see any reference to this add-in. Below is the code I use to build the control and to then delete it. Any ideas on how to get rid of all those extra buttons? public void OnStartupComplete(ref System.Array custom) { CommandBars commandBars = applicationObject.ActiveExplorer().CommandBars; try { this.toolbarButton = (CommandBarButton)commandBars["Standard"].Controls["AddSave"]; } catch (System.Exception) { this.toolbarButton = (CommandBarButton)commandBars["Standard"].Controls.Add(1, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value); this.toolbarButton.Caption = "Add/Save"; this.toolbarButton.Style = MsoButtonStyle.msoButtonCaption; } this.toolbarButton.Tag = "AddSave"; this.toolbarButton.OnAction = "!RecordEmail.Connect"; this.toolbarButton.Visible = true; this.toolbarButton.Click += new _CommandBarButtonEvents_ClickEventHandler(this.OnT oolbarButtonClick); } Below I try 2 ways to delete the item: public void OnBeginShutdown(ref System.Array custom) { CommandBars commandBars = applicationObject.ActiveExplorer().CommandBars; try { commandBars["Standard"].Controls["AddSave"].Delete(System.Reflection.Missing.Value); } catch { } object omissing = System.Reflection.Missing.Value; this.toolbarButton.Delete(omissing); this.toolbarButton = null; } -- Thanks Royal |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
NNTP add-ins for 2003? | Gordon | Outlook - General Queries | 4 | November 20th 06 09:48 AM |
Question in outlook Add-ins | Marwa | Outlook - Using Forms | 0 | August 16th 06 10:14 PM |
C++ add ins for Outloo | Carlos | Add-ins for Outlook | 1 | August 14th 06 04:11 PM |
comm add-ins | leonS | Outlook - Installation | 1 | May 1st 06 07:09 PM |
New to add-ins | Sharad Naik | Add-ins for Outlook | 9 | January 26th 06 02:04 PM |