IMessengerServices::Item method
[Item is no longer available for use as of Windows Vista. See Windows Messenger for more information.]
Retrieves a specific service by index.
Syntax
HRESULT Item(
[in] LONG Index,
[out, retval] IDispatch **ppService
);
Parameters
-
Index [in]
-
Type: LONG
LONG that specifies the index of the desired MessengerServices object in the collection.
-
ppService [out, retval]
-
Type: IDispatch**
Address of a pointer to a IDispatch interface on a MessengerServices object requested with Index. The object can now be accessed through the IMessengerServices interface.
Return value
Type: HRESULT
Returns one of the following values.
Return code | Description |
---|---|
|
Success. |
|
Invalid collection or index number provided exceeds the length of the collection. |
|
ppService is a NULL pointer. |
|
Index is not a positive integer. |
Remarks
The following table lists error codes returned by this method.
Error Code | Meaning |
---|---|
0x80004005 | Invalid collection, or index number provided exceeds the length of the collection. |
0x80070057 | Index is not a positive integer. |
If you know the name for that specific service, you can get the MessengerServices object by creating an object for it explicitly by calling ServiceName. Even if that service is already present in a list, the same pointer is returned (as it would have been by retrieving that object from an existing collection).
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 MsgrServices As MessengerAPI.IMessengerServices
Private Sub btnServicesCount_Click()
On Error Resume Next
MsgBox("Services Count= " & CStr(MsgrServices.Count))
ErrorTrap ("MsgrServices.Count") 'Error handling routine
End Sub
Requirements
End of client support |
Windows XP |
End of server support |
Windows Server 2003 |
Header |
|
IDL |
|
DLL |
|