IMessengerContacts::Remove method
[Remove is no longer available for use as of Windows Vista. See Windows Messenger for more information.]
Removes a MessengerContact object from a collection.
Syntax
HRESULT Remove(
[in] IDispatch *pMContact
);
Parameters
-
pMContact [in]
-
Type: IDispatch*
Pointer to an IDispatch interface on a MessengerContact object to be removed from the collection.
Return value
Type: HRESULT
Returns one of the following values.
Return code | Description |
---|---|
|
Success. |
|
Object pointed to by pMContact is not in the collection (as determined locally by the client). |
|
pMContact is a NULL pointer. |
|
Cannot be accessed through scripting. |
Remarks
The following table lists error codes returned by this method.
Error Code | Meaning |
---|---|
0x80004001 | Cannot be accessed through scripting. |
0x80004005 | Object pointed to by pMContact is not in the collection (as determined locally by the client). |
If this method is successful (returns S_OK), invoking this method will result in a OnContactListRemove event. This event includes any errors generated by the server, including MSGR_E_USER_NOT_FOUND, on an attempt to remove a MessengerContact object that did not exist in a list.
Note
This method is available for scripting languages only in a trusted zone.
Examples
The following Visual Basic example shows the use of this method.
Public WithEvents MsgrUIA As MessengerAPI.Messenger
Public MsgrContacts As MessengerAPI.IMessengerContacts
Public MsgrContact As MessengerAPI.IMessengerContact
Private Sub mnuRemove_Click()
On Error Resume Next
FormRemoveContact.Show vbModal 'Get user input
If bDialogCancel = False Then
MsgBox("Remove: " & strContactName & " : " & strServiceID)
Set MsgrContact = Nothing
Set MsgrContact = MsgrUIA.GetContact(strContactName, strServiceID)
MsgrContacts.Remove MsgrContact
populateListView 'Refresh contact list
End If
ErrorTrap ("Contacts.Remove") 'Error handling routine
End Sub
Requirements
End of client support |
Windows XP |
End of server support |
Windows Server 2003 |
Header |
|
IDL |
|
DLL |
|