Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / April 2005

Tip: Looking for answers? Try searching our database.

Adding new menu item to menu bar

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Saurabh Aggarwal - 23 Apr 2005 04:28 GMT
Hi

I am using your code that is used to add an explorer to the outlook. In
addition to adding explorer bar I have also added a menu bar item in my
plugin

I am using the following code to add menu to the outlook (This is in
createMenu function)
CommandBar oCommandBar = IOMCalOutlookExplorer.CommandBars["Menu Bar"];
MSO.CommandBarPopup popup = (MSO.CommandBarPopup)oCommandBar .Controls.Add
(MSO.MsoControlType.msoControlPopup,myMissing,myMissing,myMissing,1);
popup.Caption = "IO&MCal";
popup.Visible = true;
                           
MSO.CommandBar menuCmdBarSync = popup.CommandBar;
MenuSynchronizeButton = (MSO.CommandBarButton) menuCmdBarSync.Controls.Add
(MSO.MsoControlType.msoControlButton,myMissing,myMissing,1,1);
MenuSynchronizeButton.Caption = "&Synchronize";   
MenuSynchronizeButton.Click +=new
MSO._CommandBarButtonEvents_ClickEventHandler(MenuSynchronizeButton_Click);   

In Onclose function I am using the following code to free the objects

MenuSynchronizeButton.Click -=new
MSO._CommandBarButtonEvents_ClickEventHandler(MenuSynchronizeButton_Click);

if(MenuSynchronizeButton != null)
{
    Marshal.ReleaseComObject(MenuSynchronizeButton);
}

if ( IOMCalOutlookCommandBar != null)
{
    IOMCalOutlookCommandBar.Delete ();
    Marshal.ReleaseComObject (IOMCalOutlookCommandBar);   
}

if(IOMCalOutlookMenuCommandBar != null)
{
              IOMCalOutlookMenuCommandBar.Delete ();
         Marshal.ReleaseComObject (IOMCalOutlookMenuCommandBar);   
}       
if (IOMCalOutlookExplorer != null)
{
    Marshal.ReleaseComObject (IOMCalOutlookExplorer);
}

This is working fine in my outlook (outlook 2003)

But in Outlook2002  objects are not releasing properly. A new menubar is
added each time I open the outlook. And also after uninstalling plugin from
the system it is not removed from the outlook.

Regards
Saurabh
Ken Slovak - [MVP - Outlook] - 25 Apr 2005 13:55 GMT
When you add the new menu bar make it temporary. Set the Temporary property
= True.

Signature

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

> Hi
>
[quoted text clipped - 52 lines]
> Regards
> Saurabh
Saurabh Aggarwal - 26 Apr 2005 12:13 GMT
This is already true.
Could you please some example in c# which can add a menu item to the
menubar of the outlook and it gets disposed when we close it.

Regards
Saurabh
Ken Slovak - [MVP - Outlook] - 26 Apr 2005 14:33 GMT
I don't do C# so I can't supply you with any examples.

Signature

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

> This is already true.
> Could you please some example in c# which can add a menu item to the
> menubar of the outlook and it gets disposed when we close it.
>
> Regards
> Saurabh
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.