Messenger events for application, contact, contact list, group, IMWindow, and local client configuration events. These events are returned to your application when your automation code causes the event to be raised. They are also returned to your application due to user action on the running Communicator UI.

The interface ID is C9A6A6B6-9BC1-43a5-B06B-E58874EEBC96 (DIID_DMessengerEvents).

Syntax

dispinterface DMessengerEvents

Methods

The following table lists the methods exposed by the DMessengerEvents interface.

Name Description

DMessengerEvents::OnAppShutdown

Indicates that the client application is about to shut down.

Scriptable.

DMessengerEvents::OnContactAddedToGroup

Indicates that a contact has been added to a group.

Not scriptable.

DMessengerEvents::OnContactBlockChange

Indicates that the block settings of a contact in the local client's contact list have changed.

Not scriptable.

DMessengerEvents::OnContactFriendlyNameChange

Indicates that a contact in the client's contact list has changed the friendly name.

Scriptable locally for scripts not running from a Web page.

DMessengerEvents::OnContactListAdd

Indicates the result of an attempt to add to the Messenger object's contact list.

Scriptable.

DMessengerEvents::OnContactListRemove

Indicates the result of an attempt to remove a contact from the Messenger object's contact list.

Scriptable.

DMessengerEvents::OnContactPagerChange

Not supported.

DMessengerEvents::OnContactPhoneChange

Indicates that the phone information of a contact in the local client's contact list has changed.

Not scriptable.

DMessengerEvents::OnContactRemovedFromGroup

Indicates that a contact has been removed from a group.

Not scriptable.

DMessengerEvents::OnContactResolved

Not supported.

DMessengerEvents::OnContactStatusChange

Indicates that the status of a contact in the local client's contact list has changed and returns the current state of the contact.

Scriptable.

DMessengerEvents::OnGroupAdded

Indicates that a new group has been created.

Not scriptable.

DMessengerEvents::OnGroupNameChanged

Indicates that the name of a group has changed.

Not scriptable.

DMessengerEvents::OnGroupRemoved

Indicates that a group has been deleted.

Not scriptable.

DMessengerEvents::OnIMWindowContactAdded

Indicates that a contact has been added to the ongoing conversation.

Scriptable.

DMessengerEvents::OnIMWindowContactRemoved

Indicates that a contact has been removed from the ongoing conversation.

Scriptable.

DMessengerEvents::OnIMWindowCreated

Indicates that a new conversation window has been opened.

Scriptable.

DMessengerEvents::OnIMWindowDestroyed

Indicates that a new conversation window has been closed.

Scriptable.

DMessengerEvents::OnMyFriendlyNameChange

Indicates that the local client's friendly name has been changed or that a change was attempted.

Not scriptable.

DMessengerEvents::OnMyPhoneChange

Indicates that the local client's phone contact information has been changed or that a change was attempted.

Not scriptable.

DMessengerEvents::OnMyStatusChange

Indicates that the status of the local client has changed or that a status change was attempted, and returns the current status of the local client.

Scriptable.

DMessengerEvents::OnSignin

Indicates that an attempt has been made to sign in to the primary service.

Scriptable.

DMessengerEvents::OnSignout

Indicates that the local client has signed out of the primary service.

Scriptable.

DMessengerEvents::OnUnreadEmailChange

Not supported.

Properties

This interface contains no properties.

Subclasses

This interface contains no subclasses.

Remarks

Requirements

Client

Requires Microsoft DirectX 9.0, C Runtime libraries (msvcm80.dll) on Microsoft Windows© Vista, Microsoft Windows XP Service Pack 1 (SP1) or later, or Microsoft Windows 2000 with Service Pack 4 (SP4). Any Communicator-imposed restrictions apply. .

Server

Requires Microsoft Office Communications Server 2007, AV MCU (for Media Support), Media Relay (for NAT/Firewall traversal) on Microsoft Office Communications Server 2007.

Product

Microsoft Office Communicator 2007 Automation API

IDL file

Msgrua.idl

Example

This following code example illustrates how to handle the events defined in the DMessengerEvents dispinterface. The Signin function creates an IMessenger object and registers handlers for all the event classes within communicator before signing in with a user account and password. Upon exit, the application cancels the registration of each event handler.

Copy Code
// A simple implementation of signing in.
void Signin(string account, string passwd)
{
  if (connected)
	return;

  if (communicator == null)
  {
	// Create a Messenger object, if necessary
	communicator = new CommunicatorAPI.MessengerClass();
  }
  // Register event handlers for OnSignin and Signout events
  if (communicator != null)
  {
	communicator.OnSignin += new DMessengerEvents_OnSigninEventHandler(communicator_OnSignin);
	communicator.OnSignout += new DMessengerEvents_OnSignoutEventHandler(communicator_OnSignout);
	communicator.OnAppShutdown += new DMessengerEvents_OnAppShutdownEventHandler(communicator_OnAppShutdown);
	communicator.OnContactAddedToGroup += new DMessengerEvents_OnContactAddedToGroupEventHandler(communicator_OnContactAddedToGroup);
	communicator.OnContactBlockChange += new DMessengerEvents_OnContactBlockChangeEventHandler(communicator_OnContactBlockChange);
	communicator.OnContactFriendlyNameChange += new DMessengerEvents_OnContactFriendlyNameChangeEventHandler(communicator_OnContactFriendlyNameChange);
	communicator.OnContactListAdd += new DMessengerEvents_OnContactListAddEventHandler(communicator_OnContactListAdd);
	communicator.OnContactListRemove += new DMessengerEvents_OnContactListRemoveEventHandler(communicator_OnContactListRemove);
	communicator.OnContactPagerChange += new DMessengerEvents_OnContactPagerChangeEventHandler(communicator_OnContactPagerChange);
	communicator.OnContactPhoneChange += new DMessengerEvents_OnContactPhoneChangeEventHandler(communicator_OnContactPhoneChange);
	communicator.OnContactPropertyChange += new DMessengerEvents_OnContactPropertyChangeEventHandler(communicator_OnContactPropertyChange);
	communicator.OnContactRemovedFromGroup += new DMessengerEvents_OnContactRemovedFromGroupEventHandler(communicator_OnContactRemovedFromGroup);
	communicator.OnContactStatusChange += new DMessengerEvents_OnContactStatusChangeEventHandler(communicator_OnContactStatusChange);
	communicator.OnGroupAdded += new DMessengerEvents_OnGroupAddedEventHandler(communicator_OnGroupAdded);
	communicator.OnGroupNameChanged += new DMessengerEvents_OnGroupNameChangedEventHandler(communicator_OnGroupNameChanged);
	communicator.OnGroupRemoved += new DMessengerEvents_OnGroupRemovedEventHandler(communicator_OnGroupRemoved);
	communicator.OnIMWindowContactAdded += new DMessengerEvents_OnIMWindowContactAddedEventHandler(communicator_OnIMWindowContactAdded);
	communicator.OnIMWindowContactRemoved += new DMessengerEvents_OnIMWindowContactRemovedEventHandler(communicator_OnIMWindowContactRemoved);
	communicator.OnIMWindowCreated += new DMessengerEvents_OnIMWindowCreatedEventHandler(communicator_OnIMWindowCreated);
	communicator.OnIMWindowDestroyed += new DMessengerEvents_OnIMWindowDestroyedEventHandler(communicator_OnIMWindowDestroyed);
	communicator.OnMyFriendlyNameChange += new DMessengerEvents_OnMyFriendlyNameChangeEventHandler(communicator_OnMyFriendlyNameChange);
	communicator.OnMyPhoneChange += new DMessengerEvents_OnMyPhoneChangeEventHandler(communicator_OnMyPhoneChange);
	communicator.OnMyPropertyChange += new DMessengerEvents_OnMyPropertyChangeEventHandler(communicator_OnMyPropertyChange);
	communicator.OnMyStatusChange += new DMessengerEvents_OnMyStatusChangeEventHandler(communicator_OnMyStatusChange);

	int parentHandle = 0;
	//  account = null;
	if (account == null)
	{
	 try
	 {
		 communicator.AutoSignin();
	 }
	 catch (COMException x)
	 {
		 Console.WriteLine(x.ErrorCode.ToString());
	 }
}
	else
	{
	try
	{
		communicator.Signin(parentHandle, account, passwd);
}
	catch (ArgumentException AE)
	{
		Console.WriteLine(AE.Message.ToString());
}
	catch (COMException CE)
	{
		string errorString = CE.ErrorCode.ToString();
		if (errorString.Contains("MSGR_E_ALREADY_LOGGED_ON"))
			connected = true;
}
}
  }
}

...
private void Your_OC_API_tester_FormClosing(object sender, FormClosingEventArgs e)
{
   if (connected == true)
   {
	communicator.OnSignin -= new DMessengerEvents_OnSigninEventHandler(communicator_OnSignin);
	communicator.OnSignout -= new DMessengerEvents_OnSignoutEventHandler(communicator_OnSignout);
	communicator.OnAppShutdown -= new DMessengerEvents_OnAppShutdownEventHandler(communicator_OnAppShutdown);
	communicator.OnContactAddedToGroup -= new DMessengerEvents_OnContactAddedToGroupEventHandler(communicator_OnContactAddedToGroup);
	communicator.OnContactBlockChange -= new DMessengerEvents_OnContactBlockChangeEventHandler(communicator_OnContactBlockChange);
	communicator.OnContactFriendlyNameChange -= new DMessengerEvents_OnContactFriendlyNameChangeEventHandler(communicator_OnContactFriendlyNameChange);
	communicator.OnContactListAdd -= new DMessengerEvents_OnContactListAddEventHandler(communicator_OnContactListAdd);
	communicator.OnContactListRemove -= new DMessengerEvents_OnContactListRemoveEventHandler(communicator_OnContactListRemove);
	communicator.OnContactPagerChange -= new DMessengerEvents_OnContactPagerChangeEventHandler(communicator_OnContactPagerChange);
	communicator.OnContactPhoneChange -= new DMessengerEvents_OnContactPhoneChangeEventHandler(communicator_OnContactPhoneChange);
	communicator.OnContactPropertyChange -= new DMessengerEvents_OnContactPropertyChangeEventHandler(communicator_OnContactPropertyChange);
	communicator.OnContactRemovedFromGroup -= new DMessengerEvents_OnContactRemovedFromGroupEventHandler(communicator_OnContactRemovedFromGroup);
	communicator.OnContactStatusChange -= new DMessengerEvents_OnContactStatusChangeEventHandler(communicator_OnContactStatusChange);
	communicator.OnGroupAdded -= new DMessengerEvents_OnGroupAddedEventHandler(communicator_OnGroupAdded);
	communicator.OnGroupNameChanged -= new DMessengerEvents_OnGroupNameChangedEventHandler(communicator_OnGroupNameChanged);
	communicator.OnGroupRemoved -= new DMessengerEvents_OnGroupRemovedEventHandler(communicator_OnGroupRemoved);
	communicator.OnIMWindowContactAdded -= new DMessengerEvents_OnIMWindowContactAddedEventHandler(communicator_OnIMWindowContactAdded);
	communicator.OnIMWindowContactRemoved -= new DMessengerEvents_OnIMWindowContactRemovedEventHandler(communicator_OnIMWindowContactRemoved);
	communicator.OnIMWindowCreated -= new DMessengerEvents_OnIMWindowCreatedEventHandler(communicator_OnIMWindowCreated);
	communicator.OnIMWindowDestroyed -= new DMessengerEvents_OnIMWindowDestroyedEventHandler(communicator_OnIMWindowDestroyed);
	communicator.OnMyFriendlyNameChange -= new DMessengerEvents_OnMyFriendlyNameChangeEventHandler(communicator_OnMyFriendlyNameChange);
	communicator.OnMyPhoneChange -= new DMessengerEvents_OnMyPhoneChangeEventHandler(communicator_OnMyPhoneChange);
	communicator.OnMyPropertyChange -= new DMessengerEvents_OnMyPropertyChangeEventHandler(communicator_OnMyPropertyChange);
	communicator.OnMyStatusChange -= new DMessengerEvents_OnMyStatusChangeEventHandler(communicator_OnMyStatusChange);
   }
}

See Also

Reference

Messenger