IMessengerConversationWnd::AddContact method
[AddContact is no longer available for use as of Windows Vista. See Windows Messenger for more information.]
Adds another user to the current conversation.
Syntax
HRESULT AddContact(
[in] VARIANT vContact
);
Parameters
-
vContact [in]
-
Type: VARIANT
VARIANT that can take as its value either a VT_BSTR or a VT_DISPATCH pointer to an existing MessengerContact object. If the input value type is a string, this method creates a new MessengerContact object internally. The string should be the full sign-in name. For a Microsoft .NET Messenger Service contact, this should include an "at" sign (@) and domain name. If the input value type is a pointer to an existing MessengerContact object (should be type VT_DISPATCH), the existing object is used for contact information.
Return value
Type: HRESULT
Returns one of the following values.
Return code | Description |
---|---|
|
Success. |
|
vContact is NULL, the wrong type, points to a NULL string, or points to a string that has a space as the first character; or, vContact is VT_BSTR that exceeded 129 characters; or, vContact is VT_BSTR and contains a carriage return or linefeed. |
|
Client was not signed in to the primary service at the time this method was called; or, this method was called against the local client user. |
|
String comparison failed. |
|
The current conversation window is hosting a voice or video conversation; or, the maximum number of participants allowed in the session has been reached. |
|
Called this method against a user belonging to a service other than the one to which the current conversation members belong. |
Remarks
The following table lists error codes returned by this method.
Error Code | Meaning |
---|---|
0x80004005 | Client was not signed in to the primary service at the time this method was called; or, this method was called against the local client user. |
0x80070057 | vContact is NULL, the wrong type, points to a NULL string, or points to a string that has a space as the first character; or, vContact is VT_BSTR that exceeded 129 characters; or, vContact is VT_BSTR and contains a carriage return or linefeed. |
MSGR_E_SESSION_FULL | The current conversation window is hosting a voice or video conversation; or, the maximum number of participants allowed in the session has been reached. |
MSGR_E_INVALID_SERVICE | Called this method against a user belonging to a service other than the one to which the current conversation members belong. |
For a table of MSGR_E_* constants, see MSGRConstants.
The AddContact method is scriptable. However, contacts cannot be added to a conversation automatically by calling this method from script. When this method is called from script, the Contact Picker dialog is always displayed to the user so the user can select the online contact to be added to the conversation.
This method does not have a return value. Therefore, parenthetical syntax should be used for JScript, but not for Microsoft Visual Basic Scripting Edition (VBScript). All parameters of this method are required.
Note
This method is available for scripting languages.
Examples
The following Visual Basic example shows the use of this method.
Public WithEvents MsgrUIA As MessengerAPI.Messenger
Public mWindow2 As MessengerAPI.IMessengerConversationWnd
Private Sub btnWindow2AddContact_Click()
On Error Resume Next
FormContactName.Show vbModal 'Get user input
Dim strContactName_0 as String
'Launch a Conversation window with an online contact
'(where strContactName_0 is the online contact's signinname)
If bDialogCancel = False Then
Set mWindow2 = MsgrUIA.InstantMessage (strContactName_0)
mWindow2.AddContact strContactName
End If
ErrorTrap ("IMessengerConversationWnd.AddContact") 'Error handling routine
End Sub
Requirements
End of client support |
Windows XP |
End of server support |
Windows Server 2003 |
Header |
|
IDL |
|
DLL |
|