DMessengerEvents::OnContactListRemove Event

[OnContactListRemove is no longer available in Windows Vista. See Windows Messenger for more information.]

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


void OnContactListRemove(
  [in]  LONG hr,
  [in]  IDispatch *pMContact


hr [in]

Success or error code as a LONG.

An error result for hr might result in all other event parameters being meaningless, NULL, or otherwise invalid. Always check for a successful hr before attempting to use the other event parameters. For a table of MSGR_E* constants, see MSGRConstants.

Possible values are as follows:


A user was successfully removed from the Contact List.


The contact specified to be removed was not found in the Contact List.


The server has returned an unexpected error code.


The server is not processing requests or not accepting new connections.


The server was contacted, but was unavailable for unspecified reasons.


pMContact [in]
Pointer to a IDispatch interface on the MessengerContact object that corresponds to the removed contact. Using this pointer, clients can now code to its IMessengerContact interface. A MessengerContact object that corresponds to the removed contact.

Return Value

This event does not return a value.


This event comes in response to the Remove method. If Remove did not return S_OK, no notification is received. For example, attempting to remove a user without specifying a string for username is prevented by the Remove method, which returns E_FAIL even before submission to the protocol and generates no event.

The Microsoft .NET Messenger Service always submits remove requests to the server and does not check local lists first. Other services may check local lists first and issue this event locally without submitting to the protocol for some of the error cases.

Removing a MessengerContact object from the Contact List does not release it from memory or otherwise deallocate it. Clients can deallocate the MessengerContact object as soon as it is removed from the Contact List or later after the client has shut down. A MessengerContact object that is not in the Contact List is still a valid object (for example, it could be used as the VARIANT argument in a InstantMessage call). After the object or contact is out of the Contact List, no status updates will be received from the server about this contact. As a result, when launching an instant message as described, the client will not be able to determine whether that contact is online until the message is sent.

This event is also issued whenever an attempt is made to remove a contact from the Contact List through user action in the UI or through other internal method calls.

To be used when writing custom ::Invoke methods to handle these events.

ParametervaArgs[x]Variant Type


Note  This event is available for scripting languages.


Minimum supported client

Windows 2000 Professional, Windows XP

Minimum supported server

Windows Server 2003


Messenger 4.5







See Also




Send comments about this topic to Microsoft

Build date: 6/30/2010