Events

Events

This section describes the events associated with the Microsoft Chat control.


OnBeginEnumeration Event

Description

Occurs when a user enters a chat room, before the list of members already in the conversation appears in the Participant list box.

Syntax

object_OnBeginEnumeration

ValueDescription
object Required. An object expression that evaluates to a Chat control.

See Also

EnterRoom, OnEndEnumeration, UIOption


OnEndEnumeration Event

Description

Occurs after getting the initial list of members in the conversation, including the user.

Syntax

object_OnEndEnumeration

ValueDescription
object Required. An object expression that evaluates to a Chat control.

Remarks

The user can start to use the ThisParticipantID property or the SetParticipantStatus, KickParticipant, BanParticipant, and SendMessage methods once this event is triggered.


OnEnterParticipant Event

Description

Occurs when either the list of members already in the conversation first appears when entering a chat room or when a new participant joins the conversation.

Syntax

object_OnEnterParticipant(ParticipantID, Name, Status)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
ParticipantID A long integer value that contains the participant ID of the member entering the chat room.
Name A BSTR value that contains the alias of the member joining the chat room.
Status A short integer value indicating the status of the member entering the room. Can be one of the following values.
Value Description
1 Member is a host.
2 Member is a participant.
4 Member is a spectator.

See Also

EnterRoom


OnError Event

Description

Occurs when there is an error in the control. If the display dialog boxes flag (value=512) is set in the UIOption property, the error message is displayed to the user.

Syntax

object_OnError(ErrorCode, Description)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
ErrorCode A short integer value that contains the numeric value of the error code.
Description A BSTR value that contains the error message that is associated with the error code.


OnExitParticipant Event

Description

Occurs when a member leaves the chat room.

Syntax

object_OnExitParticipant(ParticipantID)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
ParticipantID A long integer value that contains the participant ID of the member exiting the chat room.

See Also

ExitRoom


OnHistoryFull Event

Description

Occurs each time a message is added to the History text box, when the total number of characters in the History text box is at least 90 percent of the MaxHistoryLength property (which is the maximum number of characters allowed in the History text box).

Syntax

object_OnHistoryFull(Percent)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
Percent The exact percentage of the History text box's maximum length that has been used.

Remarks

If the History text box gets too full to contain an incoming message, the top 20 percent of the text box's contents are removed. If this does not give enough space to fit the incoming message, more text is removed.

See Also

ClearHistory, History, UIOption


OnMessage Event

Description

Occurs when a user gets a message from a member or the chat room.

Syntax

object_OnMessage(SenderID, Message, MessageType)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
SenderID A long integer that contains the participant ID of the member who sent the message, or zero if the message comes from the chat room.
Message A VARIANT value that contains the message. The incoming message can be a text message (BSTR) or data (an array of bytes, shorts, longs, floats, doubles, Booleans, errors, currencies, or dates).
MessageType Can be a combination of the following values.
Value Description
0 A text or data message that is broadcast to all members.
1 A text or data message that is whispered to one or more members.
2 A ComicChat thought, which is text only.
4 An action, which is text only.

See Also

SendMessage, OnTextMessageSent, ThisParticipantID


OnParticipantAliasChanged Event

Description

Occurs when the member's alias is changed. Also, if the display notifications flag (value=128) is set in the UIOption property, a dialog box is displayed that says: "<OldAlias> is now known as <NewAlias>."

Syntax

object_OnParticipantAliasChanged(ParticipantID, OldAlias, NewAlias)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
ParticipantID A long integer value that contains the participant ID of the member whose alias is changing.
OldAlias A BSTR value that contains the old alias.
NewAlias A BSTR value that contains the new alias.

See Also

ThisParticipantAlias


OnParticipantInvited Event

Description

Occurs when a member invites the user to the member's chat room.

Syntax

object_OnParticipantInvited(RoomName, Alias)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
RoomName A string value containing the name of the member's chat room.
Alias A string value containing the name of the member who invited the user to the member's chat room.

See Also

InviteParticipant, ThisParticipantAlias


OnParticipantKicked Event

Description

Occurs when the user is kicked from the chat room.

Syntax

object_OnParticipantKicked(ParticipantID, Reason)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
ParticipantID A long integer value that contains the participant ID of the host who kicked the user from the chat room.
Reason A BSTR value that contains the reason given for kicking the user from the chat room. This value can be an empty string, if no reason was given.

See Also

KickParticipant, ThisParticipantID


OnParticipantRealName Event

Description

Occurs when a successful call is made to GetParticipantRealName with the Synchronous parameter set to FALSE.

Syntax

object_OnParticipantRealName(Alias, RealName)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
Alias A BSTR value that contains the current alias of the member.
RealName A BSTR value that contains the real name of the member.

See Also

ThisParticipantName


OnParticipantStatusChanged Event

Description

Occurs when a member changes status.

Syntax

object_OnParticipantStatusChanged(ParticipantID, Status)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
ParticipantID A long integer value that contains the participant ID of the member whose status is changing.
Status A short integer value that indicates the new status of the member. The new status is a combination of the following values.
Value Description
1 Member has become a host.
2 Member has become a participant.
4 Member has become a spectator.
8 Member does not allow whispers.
16 Member is ignored, so all incoming messages from this member are discarded.

Remarks

Any member is either a host (Status=1), participant (Status=2), or spectator (Status=4), so a valid status must include one of these values.

See Also

SetParticipantStatus, ThisParticipantID


OnRoomTopicChanged Event

Description

Occurs when the room topic property changes.

Syntax

object_OnRoomTopicChanged(NewRoomTopic)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
NewRoomTopic A BSTR value that contains the description of the new topic of conversation.

See Also

RoomTopic


OnRoomTypeChanged Event

Description

Gives the value of the new room type.

Syntax

object_OnRoomTypeChanged(NewRoomType)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
NewRoomType A short integer value that equals the sum of the room type settings. Can be a combination of the following values.
Value Description
1 Allows any user into the chat room.
2 Allows only hosts to change the topic of the chat room.
4 Allows only users who logged on to this server to enter the chat room.
8 Disables whispering in the chat room.
16 Creates an auditorium room. The member list shows only the user and the hosts. Participants cannot whisper, but hosts can whisper to anybody, regardless of whether the no-whisper (NewRoomType=8) flag is set. Messages coming from participants are sent only to the hosts.
32 Creates a moderated room. Members join the chat room as spectators by default.

Remarks

For example, if NewRoomType=10, it means that only hosts can change the room topic (NewRoomType=2), and no whispers are allowed in the room (NewRoomType=8).

See Also

EnterRoom


OnStateChanged Event

Description

Occurs when the user's state changes.

Syntax

object_OnStateChanged(NewState)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
NewState A short integer that indicates the user's new state. Can be one of the following values.
Value Description
1 Disconnected from any chat rooms.
2 Connecting to a chat room.
3 Connected to a chat room.

See Also

State


OnTextMessageSent Event

Description

Occurs whenever the user sends a text message by using the internal Send button or Whisper button.

Syntax

object_OnTextMessageSent(TextMessage, MessageType)

ValueDescription
object Required. An object expression that evaluates to a Chat control.
TextMessage A BSTR value that contains the text sent by the user.
MessageType A short integer value that indicates the type of message sent. Can be one of the following values.
Value Description
0 The user sent some text as a broadcast to all members.
1 The user sent some text as a whisper to one or more members.

Remarks

This event is not triggered when using the SendMessage method.

See Also

UIOption

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