# IRdNtChatDisp Interface Reference

Inherits IDispatch.

List of all members.

## Public Member Functions
HRESULT | Clear (void)
HRESULT | AddMsg ([in] IDispatch *pRdNtChatMsg)
HRESULT | GetNumMsgs (RtDWORD *pdwNumMsgs)
HRESULT | GetMsg (RtDWORD dwMsgNum, IDispatch **ppRdNtChatMsg)
## Properties
RtDWORD * | MaxNumOfMsgs`[get]`
RtDWORD | MaxNumOfMsgs`[set]`

## Detailed Description

This interfaces accessing object stores all the chat messages. It is generated for example by client object into Chat connector (see IRiNetwork::NtConnectTo) that you can find in /Network space after you enter into a Shared Space.

Example: This example demonstrates usage of IRdNtChatDisp and IRdNtChatMsg objects. The code below create its own RdNtChat object, but you can read the one stored in Chat connector too.

        // Create chat message and fill it with a data
        RdNtChatMsg = System.CreateDO("Network Package/Net Chat Msg Data");
        RdNtChatMsg.ClientName = 'tester';
        RdNtChatMsg.Text = 'This is a text';

        // Create chat object and add the chat message into it.
        RdNtChat = System.CreateDO("Network Package/Net Chat Data");
        RdNtChat.AddMsg(RdNtChatMsg);

        // Now enumerate all messages in RdNtChat object and show them in debug view.
        dwNumMsgs = RdNtChat.GetNumMsgs();
        for (ind = 0; ind < dwNumMsgs; ind++)
        {
            RdNtChatMsg = RdNtChat.GetMsg(ind);
            bstrLine = RdNtChatMsg.ClientName() + ': ' + RdNtChatMsg.Text() + '\n';
            System.Trace(bstrLine);
        }

See also:
  IRdNtChatMsg, IRdNtChat

## Member Function Documentation

HRESULT IRdNtChatDisp::Clear | ( | void |  | ) |

Delete all the chat messages.

        RdNtChat.Clear();

HRESULT IRdNtChatDisp::AddMsg | ( | [in] IDispatch * | pRdNtChatMsg | ) |

Add new message.

Parameters:

  | pRdNtChatMsg | [in] New chat message IRdNtChatMsg object.

        RdNtChat = System.CreateDO("Network Package/Net Chat Data");
        RdNtChat.AddMsg(RdNtChatMsg);

HRESULT IRdNtChatDisp::GetNumMsgs | ( | RtDWORD * | pdwNumMsgs | ) |

Get number of stored messages

Returns:
  pdwNumMsgs [out, retval] Returns number of stored messages.

        dwNumMsgs = RdNtChat.GetNumMsgs();

HRESULT IRdNtChatDisp::GetMsg | ( | RtDWORD | dwMsgNum,
|  | IDispatch ** | ppRdNtChatMsg |
| ) |  |  |

Get message with specified index.

Parameters:

  | dwMsgNum | [in] Index of the message you want to read.

Returns:
  ppRdNtChatMsg [out, retval] Returned IRdNtChatMsg message object.

        for (ind = 0; ind < dwNumMsgs; ind++)
        {
            RdNtChatMsg = RdNtChat.GetMsg(ind);
            bstrLine = RdNtChatMsg.ClientName() + ': ' + RdNtChatMsg.Text() + '\n';
            System.Trace(bstrLine);
        }

## Property Documentation

RtDWORD * IRdNtChatDisp::MaxNumOfMsgs`[get]`

Read maximum number of stored chat messages in this object.

Returns:
  pdwMaxNum [out, retval] Number of the messages.

     maxMessages = RdNtChat.MaxNumOfMsgs();

RtDWORD IRdNtChatDisp::MaxNumOfMsgs`[set]`

Set maximum number of stored messages. The default value is 100.
If new message is added and object already storing the maximum number of messages,
then the last one is removed and all other messages are shifted.

Returns:
  pdwMaxNum [out, retval] The maximum number of stored messages.

     RdNtChat.MaxNumOfMsgs() = 50;