Events
Objects

Events

This section describes the events associated with the MsChatPr object.


OnAddMember Event

Description

Fires when entering a channel or when a new member joins an open channel.

Syntax

object_OnAddMember(Channel, Nickname, MemberItems)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
Channel Required. An object expression that evaluates to a Channel object.
Nickname Required. A string expression that contains the user's Nickname.
MemberItems Required. An object expression that evaluates to a ChatItems object.

Remarks

When entering a channel, the control user receives the initial member list through OnAddMember events. One OnAddMember event also occurs for each incoming new member.

To determine the valid MemberItems of the object, use the ValidItems property.


OnBeginEnumeration Event

Description

Fires at the beginning of an enumeration, when entering a channel or listing users, members, or channels.

Syntax

object_OnBeginEnumeration(Channel, EnumType)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
Channel Required. An object expression that evaluates to a Channel object.
EnumType Required. A variable of enumEnumType type.

See Also

CreateChannel, ListChannels, ListUsers


OnChannelError Event

Description

Fires when an asynchronous error related to a channel occurs.

Syntax

object_OnChannelError(Channel, ErrorCode, Description)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
Channel Required. An object expression that evaluates to a Channel object.
ErrorCode Required. A long integer value that indicates the channel error code.
Description Required. A string expression that contains the description of the error.

See Also

CreateChannel


OnChannelProperty Event

Description

Fires after a ListChannels or QueryChannelProperty call.

Syntax

object_OnChannelProperty(Channel, ChannelItems)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
Channel Required. An object expression that evaluates to a Channel object.
ChannelItems Required. An object expression that evaluates to a ChatItems object.

Remarks

This event can also be fired after a time-out occurs while accessing a ChannelProperty property.

To determine the valid ChannelItems of the object, use ValidItems property.


OnChannelPropertyChanged Event

Description

Fires when a channel property changes, such as after calling ChangeChannelProperty.

Syntax

object_OnChannelPropertyChanged(Channel, ModifierNickname, ChannelPropertyName, OldChannelProperty, NewChannelProperty)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
Channel Required. An object expression that evaluates to a Channel object.
ModifierNickname Required. A string expression containing the modifier nickname.
ChannelPropertyName Required. A string expression containing the name of the channel property that changed.
OldChannelProperty Required. A variant, the type of which depends on the old channel property.
NewChannelProperty Required. A variant, the type of which depends on the new channel property.

See Also

ChangeChannelProperty


OnChannelState Event

Description

Fires after a CreateChannel, JoinChannel, or LeaveChannel call or after an asynchronous event, such as being kicked out of the room or being disconnected.

Syntax

object_OnChannelState(Channel, NewChannelState)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
Channel Required. An object expression that evaluates to a Channel object.
NewChannelState Required. A short integer of enumChannelState type.

See Also

CreateChannel, JoinChannel, LeaveChannel


OnConnectionError Event

Description

Fires when an asynchronous error occurs.

Syntax

object_OnConnectionError(ErrorCode, Description, ChannelName)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
ErrorCode Required. A long integer containing the value of the error code.
Description Required. A string expression containing the description of the error code.
ChannelName Required. A variant, the type of which depends on the name of the channel.


OnConnectionState Event

Description

Fires after Connect, Login, CancelConnectLogin, and Disconnect calls or when an asynchronous disconnection occurs.

Syntax

object_OnConnectionState(NewConnectionState)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
NewConnectionState Required. A variable of enumConnectionState type.

Example

Dim NewConnectionState As enumConnectionState

NewConnectionState = MsChatPr1.ConnectionState


OnDelMember Event

Description

Fires when a member leaves an open channel or is kicked out of the channel.

Syntax

object_OnDelMember(Channel, Nickname)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
Channel Required. An object expression that evaluates to a Channel object.
Nickname Required. A string expression that contains the Nickname of the user who is leaving the channel.

See Also

KickMember, OnMemberKicked


OnEndEnumeration Event

Description

Fires at the end of an enumeration, when entering a channel or listing users, members, or channels.

Syntax

object_OnEndEnumeration(Channel, EnumType)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
Channel Required. An object expression that evaluates to a Channel object.
EnumType Required. A variable of enumEnumType type.

See Also

CreateChannel, ListChannels, ListUsers


OnInvitation Event

Description

Fires when the control user is invited to a channel.

Syntax

object_OnInvitation(ChannelName, InviterItems)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
ChannelName Required. A string expression that represents the channel to which the user is invited.
InviterItems Required. An object expression that evaluates to a ChatItems object. Gives all the known information about the user who is performing the inviting.

See Also

SendInvitation

Remarks

To determine the valid InviterItems of the object, use ValidItems property.


OnKnock Event

Description

Fires when a user failed to enter a channel.

Syntax

object_OnKnock(Channel, KnockerItems, ErrorCode)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
Channel Required. An object expression that evaluates to a Channel object.
KnockerItems Required. An object expression that evaluates to a ChatItems object.
ErrorCode Required. A long integer value that indicates why the user could not join the channel. Examples are that the channel is full, the channel is invite-only, or a channel Keyword is set.

Remarks

Only the hosts of the channel receive this notification. Also, the notification occurs only if the cmKnock flag is set for that channel.

To determine the valid KnockerItems of the object, use ValidItems property.


OnMemberKicked Event

Description

Fires when a member is kicked out of the channel.

Syntax

object_OnMemberKicked(Channel, KickedNickname, KickerNickname, Reason)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
Channel Required. An object expression that evaluates to a Channel object.
KickedNickname Required. A string expression containing the Nickname of the member who is being kicked.
KickerNickname Required. A string expression containing the Nickname of the member who is doing the kicking.
Reason Required. A string expression containing the reason the member is being kicked, or it can be empty.

Remarks

This event can result from a KickMember method call and is immediately followed by an OnDelMember event.


OnMemberProperty Event

Description

Fires after a ListMembers or QueryMemberProperty call.

Syntax

object_OnMemberProperty(Channel, MemberItems)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
Channel Required. An object expression that evaluates to a Channel object.
MemberItems Required. An object expression that evaluates to a ChatItems object.

Remarks

This event can also be fired after a time-out occurs while accessing the MemberProperty property.

To determine the valid MemberItems of the object, use the ValidItems property.


OnMemberPropertyChanged Event

Description

Fires when a member property changes, such as after a ChangeMemberProperty or ChangeNickname call.

Syntax

object_OnMemberPropertyChanged(Channel, ModifiedNickname, ModifierNickname, MemberPropertyName, OldMemberProperty, NewMemberProperty)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
Channel Required. An object expression that evaluates to a Channel object.
ModifiedNickname Required. A string expression containing the Nickname of the member that is being modified.
ModifierNickname Required. A string expression containing the Nickname of the modifier.
MemberPropertyName Required. A string containing a valid member property name value. Can be Modes or Nickname.
OldMemberProperty Required. A variant, the data type of which is dependent on the old member property.
NewMemberProperty Required. A variant, the data type of which is dependent on the new member property.

See Also

MemberProperty, QueryMemberProperty


OnMessage Event

Description

Fires when a member sends a message to the channel or members of the channel including the control user.

Syntax

object_OnMessage(Channel, SenderNickname, MessageType, Message, RecipientNicknames, DataMessageTag)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
Channel Required. An object expression that evaluates to a Channel object.
SenderNickname Required. A string expression that contains the Nickname of the sender.
MessageType Required. A long integer of enumMessageType type.
Message Required. A variant. When the data message is received and the msgtDataRaw flag is not set, the Message parameter can be a number, a string, an array of numbers, an array of strings, or an array of variants that are strings or numbers. This is exactly like the Message parameter used in the SendMessage method.

However, when the msgtDataRaw flag is set, the Message parameter is an array of these three variants:
Message[0] The postprocessed string that represents the array of bytes received.
Message[1] An array of bytes.
Message[2] An array of variants that are bytes.

RecipientNicknames Required. An array of variants that are strings when the incoming message is a whisper (that is, that originates from the SendMessage call that uses the msgtWhisper type).

RecipientNicknames is a string containing the user's nickname when the message is a multicasted data message (that is, a data message that was sent to one or more channel members including the control user). This differentiates the data messages that were sent to the channel where RecipientNicknames is an empty variant and those that were sent to channel member(s). RecipientNicknames is an empty variant in all other cases.

DataMessageTag Required. A variant. Empty when the Message parameter is a string, and must be a string expression when Message is data.


OnPrivateMessage Event

Description

Fires when a user sends a private message to the control user.

Syntax

object_OnPrivateMessage(SenderNickname, PrivateMessageType, Message, DataMessageTag)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
SenderNickname Required. A string expression containing the Nickname of the sender.
PrivateMessageType Required. A long integer.
Message Required. A variant. When a data message is received and the pmtDataRaw flag is not set, the Message parameter can be a number, a string, an array of numbers, an array of strings, or an array of variants that are strings or numbers. This is exactly like the Message parameter used in the SendPrivateMessage method.

However, when the pmtDataRaw flag is set, the Message parameter is an array of these three variants:
Message[0] The postprocessed string that represents the array of bytes received.
Message[1] An array of bytes.
Message[2] An array of variants that are bytes.

DataMessageTag Required. A variant. This parameter is empty when the Message parameter is a string, and is a string when Message is data.


OnProtocolMessage Event

Description

Fires for any incoming server message when the ProcessProtocolMessages property is set to FALSE.

Syntax

object_OnProtocolMessage(MessagePrefix, MessageCommand, MessageParameters, EnableDefault)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
MessagePrefix Required. A string expression.
MessageCommand Required. A string expression.
MessageParameters Required. An array of string variants.
EnableDefault Required. An OLE_ENABLEDEFAULTBOOL.

Remarks

If the ProcessProtocolMessages property is set to TRUE, this event is fired for incoming messages that are not internally treated by the control.


OnServerProperty Event

Description

Fires after a QueryServerProperty call.

Syntax

object_OnServerProperty(ServerItems)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
ServerItems Required. An object expression that evaluates to a ChatItems object.

Remarks

This event can also be fired after a time-out occurs while accessing the ServerProperty property.

To determine the valid ServerItems of the object, use ValidItems property.

See Also

ItemValid


OnServerTextMessage Event

Description

Fires for incoming server text messages.

Syntax

object_OnServerTextMessage(ServerMessageType, Text)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
ServerMessageType Required. A variable of enumServerMessageType type.
Text Required. A string expression that contains the text message.


OnUserProperty Event

Description

Fires after a ListUsers or QueryUserProperty call.

Syntax

object_OnUserProperty(UserItems)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
UserItems Required. An object expression that evaluates to a ChatItems object.

Remarks

This event can also be fired after a time-out occurs while accessing the UserProperty property.

To determine the valid UserItems of the object, use ValidItems property.


OnUserPropertyChanged Event

Description

Fires when a user property changes.

Syntax

object_OnUserPropertyChanged(ModifiedNickname, ModifierNickname, UserPropertyName, OldUserProperty, NewUserProperty)

PartDescription
object Required. An object expression that evaluates to an MsChatPr control.
ModifiedNickname Required. A string expression that contains the Nickname being modified.
ModifierNickname Required. A string expression that contains the Nickname of the modifier, or it can be empty.
UserPropertyName Required. A variant, the type of which depends on the user property name.
OldUserProperty Required. A variant, the type of which depends on the old user property.
NewUserProperty Required. A variant, the type of which depends on the new user property.

Remarks

This event can occur after calling ChangeUserProperty or ChangeNickname, for example.

To determine the valid UserItems of the object, use the ValidItems property.


Channel Object

After logging in to a chat server, the Channel object is added to the Channels collection with the Add method.

This section lists the methods and properties supported by the Channel object.

Properties

ChannelName, ChannelProperty, ChannelState, ChannelTopic, Index, MemberCount, MemberIdentity, MemberModes, MemberProperty

Methods

BanMembers, ChangeChannelProperty, ChangeMemberProperty, CreateChannel, JoinChannel, KickMember, LeaveChannel, ListMembers, QueryChannelProperty, QueryMemberProperty, SendInvitation, SendMessage

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.