A single-user MSN® Messenger Activity does not need event handlers for connection- or data-related events, because no invitation needs to be sent, and there is no connection.
If an application is granted one of the special permissions for instant messaging, it can participate in the exchange of instant messages. This feature may be useful for an application that translates incoming messages for display in the Messenger Conversation window.
The following processes are available to a single-user Activity:
- Sending and receiving instant messages (with appropriate permission flags)
- Error handling
Sending and Receiving Instant Messages
A single-user application can interact with instant messages by using the methods Channel.EnterIM, Channel.SendIM, or Channel.SendIMAsUser.
The methods Channel.SendIM and Channel.SendIMAsUser can be used to send instant messages.
An application that can receive instant messages must have an event handler called Channel.OnIMReceived. This event fires when the client receives an instant message.
Special permissions are required to use the instant message features. For more information on special permissions, see Standard vs. Advanced Applications.
An application should have an event handler for Channel.OnDataError. This event fires if Channel.SendIM or Channel.SendIMAsUser fails. When the event OnDataError is fired, the property Channel.Error.Type is set to an integer representing the type of error, and the property Channel.Error.Data provides a copy of the data. Typically, an application should try to send the data again, in case the error was an isolated communication problem.