PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Program Addins Interoperability

Reply

Interoperability

 
Thread Tools Rate Thread
Old 15-07-2003, 07:57 PM   #1
Patrick Jox
Guest
 
Posts: n/a
Default Interoperability


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

}

}

}


--
---
Best Regards

Patrick Jox




  Reply With Quote
Old 16-07-2003, 08:25 AM   #2
Patrick Jox
Guest
 
Posts: n/a
Default Re: Interoperability

Ok I blieve, that I solved this problem following the idea in the answer of
dimitry in the posting below.

Since both COM-Addins worked with Outlook.ContactItem.Properties they had
the same Tag i.e. Firstname. Now every CommandBarButton has a unique Tag and
it seems to work.

cu - Patrick

"Patrick Jox" <patrickj@stz-sysan.de> schrieb im Newsbeitrag
news:e3D2iywSDHA.3132@tk2msftngp13.phx.gbl...
> 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);
>
> }
>
> }
>
> }
>
>
> --
> ---
> Best Regards
>
> Patrick Jox
>
>
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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