P
Patrick Jox
Hi,
I have developped a COM Addin (lets call it CA1) using VB6.0 it works fine.
Now I am testing around with COM Addins developed using C# Visual Studio
..NET 2003 (I call it CA2). Both Addins expose a user interface in Word where
Information form Outlook is addressed. Both
have a CommandBarPopup with different CommandBarButtons. I am experiencing
some very strange behaviors.
The following situation
CA1 is installed first. Iit works fine
CA2 is installed after that it also works but how. When I press different
CommandBarButtons on CA2 the associated actions are executed from CA2. But
sometimes (allways with the same buttons) there is also executed actions
from CA1. Very strange. The best is i have corresponding buttons in both
addins. So when I click onto Firstname of CA2 the action associated to the
Firstname Button in CA1 is executed.
Then I uninstalled CA1. Now CA2 is working fine. Then I reinstalled CA1 and
now the behavior turned. CA2 is still working fine, but now clicking of the
buttons in CA1 performs actions of CA2
Any Ideas where this can come from?
Here is some of my Code
namespace Test004
{
/// <summary>
/// Zusammenfassung für OfficeUI.
/// </summary>
public class OfficeUI
{
public static CommandBarPopup jxMenu;
public static CommandBarButton jxMenuItem;
public static string _jxMenuName = "Test004";
public static string _jxMenuItemName = "Kontakt anzeigen";
public static void CreateMenus()
{
try
{
DeleteMenu();
jxMenu = (CommandBarPopup)Connect.applicationObject.CommandBars["Menu Bar"].
Controls.Add(Microsoft.Office.Core.MsoControlType.msoControlPopup,
Missing.Value, Missing.Value, Missing.Value, Missing.Value);
jxMenu.Caption = _jxMenuName;
jxMenu.Tag = _jxMenuName;
jxMenuItem =
(CommandBarButton)jxMenu.Controls.Add(MsoControlType.msoControlButton,
Missing.Value, Missing.Value, Missing.Value, Missing.Value);
jxMenuItem.Caption = _jxMenuItemName;
jxMenuItem.Tag = _jxMenuItemName;
Events.RegisterMenuClickEvent(jxMenuItem);
ShowOutlookPropertyButton("Vorname", "Firstname");
ShowOutlookPropertyButton("Nachname", "Lastname");
ShowOutlookPropertyButton("Vollständiger Name", "Fullname");
ShowOutlookPropertyButton("Telefon geschäftlich",
"BusinessTelephoneNumber");
ShowOutlookPropertyButton("Firmenname und Name", "CompanyAndFullName");
ShowOutlookPropertyButton("Telefax geschäftlich", "BusinessFaxNumber");
ShowOutlookPropertyButton("Postanschrift", "MailingAddress");
}
catch(Exception e)
{
}
}
public static void DeleteMenu()
{
try
{
CommandBarPopup popup = (CommandBarPopup)
Connect.applicationObject.CommandBars["Menu Bar"].
Controls[_jxMenuName];
popup.Delete(Missing.Value);
}
catch(Exception)
{
}
}
public static void ShowOutlookPropertyButton(string Displayname,
string Propertyname)
{
jxMenuItem =
(CommandBarButton)jxMenu.Controls.Add(MsoControlType.msoControlButton,
Missing.Value, Missing.Value, Missing.Value, Missing.Value);
jxMenuItem.Caption = Displayname;
jxMenuItem.Tag = Propertyname;
Events.RegisterMenuClickEvent(jxMenuItem);
}
}
}
I have developped a COM Addin (lets call it CA1) using VB6.0 it works fine.
Now I am testing around with COM Addins developed using C# Visual Studio
..NET 2003 (I call it CA2). Both Addins expose a user interface in Word where
Information form Outlook is addressed. Both
have a CommandBarPopup with different CommandBarButtons. I am experiencing
some very strange behaviors.
The following situation
CA1 is installed first. Iit works fine
CA2 is installed after that it also works but how. When I press different
CommandBarButtons on CA2 the associated actions are executed from CA2. But
sometimes (allways with the same buttons) there is also executed actions
from CA1. Very strange. The best is i have corresponding buttons in both
addins. So when I click onto Firstname of CA2 the action associated to the
Firstname Button in CA1 is executed.
Then I uninstalled CA1. Now CA2 is working fine. Then I reinstalled CA1 and
now the behavior turned. CA2 is still working fine, but now clicking of the
buttons in CA1 performs actions of CA2
Any Ideas where this can come from?
Here is some of my Code
namespace Test004
{
/// <summary>
/// Zusammenfassung für OfficeUI.
/// </summary>
public class OfficeUI
{
public static CommandBarPopup jxMenu;
public static CommandBarButton jxMenuItem;
public static string _jxMenuName = "Test004";
public static string _jxMenuItemName = "Kontakt anzeigen";
public static void CreateMenus()
{
try
{
DeleteMenu();
jxMenu = (CommandBarPopup)Connect.applicationObject.CommandBars["Menu Bar"].
Controls.Add(Microsoft.Office.Core.MsoControlType.msoControlPopup,
Missing.Value, Missing.Value, Missing.Value, Missing.Value);
jxMenu.Caption = _jxMenuName;
jxMenu.Tag = _jxMenuName;
jxMenuItem =
(CommandBarButton)jxMenu.Controls.Add(MsoControlType.msoControlButton,
Missing.Value, Missing.Value, Missing.Value, Missing.Value);
jxMenuItem.Caption = _jxMenuItemName;
jxMenuItem.Tag = _jxMenuItemName;
Events.RegisterMenuClickEvent(jxMenuItem);
ShowOutlookPropertyButton("Vorname", "Firstname");
ShowOutlookPropertyButton("Nachname", "Lastname");
ShowOutlookPropertyButton("Vollständiger Name", "Fullname");
ShowOutlookPropertyButton("Telefon geschäftlich",
"BusinessTelephoneNumber");
ShowOutlookPropertyButton("Firmenname und Name", "CompanyAndFullName");
ShowOutlookPropertyButton("Telefax geschäftlich", "BusinessFaxNumber");
ShowOutlookPropertyButton("Postanschrift", "MailingAddress");
}
catch(Exception e)
{
}
}
public static void DeleteMenu()
{
try
{
CommandBarPopup popup = (CommandBarPopup)
Connect.applicationObject.CommandBars["Menu Bar"].
Controls[_jxMenuName];
popup.Delete(Missing.Value);
}
catch(Exception)
{
}
}
public static void ShowOutlookPropertyButton(string Displayname,
string Propertyname)
{
jxMenuItem =
(CommandBarButton)jxMenu.Controls.Add(MsoControlType.msoControlButton,
Missing.Value, Missing.Value, Missing.Value, Missing.Value);
jxMenuItem.Caption = Displayname;
jxMenuItem.Tag = Propertyname;
Events.RegisterMenuClickEvent(jxMenuItem);
}
}
}