IMessengerContact::IsSelf property

[IsSelf is no longer available for use as of Windows Vista. See Windows Messenger for more information.]

Retrieves a Boolean value that declares whether the contact associated with this MessengerContact object is actually the current client user.

This property is read-only.

Syntax

HRESULT get_IsSelf(
  [out, retval] VARIANT_BOOL *pBoolSelf
);

Property value

Pointer to a VARIANT_BOOL that declares whether this MessengerContact object is the same user as the current client user (determined by a comparison of sign-in names, which are unique per service). VARIANT_TRUE means the contact is the current client user. VARIANT_FALSE means the contact is not the current client user.

Error codes

Returns one of the following values.

Name Meaning
S_OK
Success.
E_FAIL
pbstrFriendlyName returned a NULL string.
RPC_X_NULL_REF_POINTER
pBoolSelf was a NULL pointer.

Remarks

The following table lists error codes returned by this method.

Error Code Meaning
0x80004005 General internal failure.
0x8007000E Error returned by VARIANT handling library.
0x80070057 Requested an out-of-range property. This is not normally returned through this interface because the API calls a property that is known to be in range.

The IsSelf property is scriptable.

Although users can add themselves as a contact, the Messenger client blocks users from sending instant messages to themselves. Other clients may duplicate this enforcement by checking this method's value before calling methods such as InstantMessage.

If this method is called while the client is offline, it will not fail, but will always return FALSE, even if the user represented by the MessengerContact object and the local client user are the same.

Note

This property is available for scripting languages.

Examples

The following Visual Basic example shows the use of this method.

Public WithEvents MsgrUIA As MessengerAPI.Messenger
Public MsgrContact As MessengerAPI.IMessengerContact

Private Sub mnuIsSelf_Click()
    On Error Resume Next
    Dim strSigninName As String
    Dim strServiceID As String
    'Get selected contact
    strSigninName = ListContact.SelectedItem.SubItems(2)
    strServiceID = ListContact.SelectedItem.SubItems(5)
    Set MsgrContact = Nothing
    Set MsgrContact = MsgrUIA.GetContact(strSigninName, strServiceID)
    ErrorTrap ("GetContact")    'Error handling routine
    If MsgrContact.IsSelf = True Then
        MsgBox("Contact: " & CStr(MsgrContact.SigninName) & " is self")
    Else
        MsgBox("Contact: " & CStr(MsgrContact.SigninName) & " is NOT self")
    End If
    ErrorTrap ("Contact.IsSelf")    'Error handling routine
End Sub

Requirements

End of client support
Windows XP
End of server support
Windows Server 2003
Header
Msgrua.h
IDL
Msgrua.idl
DLL
Msgsc.dll

See also

IMessengerContact

MySigninName