Platform SDK: DirectX

DirectPlayMessage.SetMessageData

The DirectPlayMessage.SetMessageData method writes data of a user-defined type to a message.

object.SetMessageData(userDefinedType As Any, size As Long)

Parameters

object
Object expression that resolves to a DirectPlayMessage object.
userDefinedType
Type containing the message data. All members of the user defined type must be numeric types, not strings. Typically the first member of the type is a Long defining the message type.
size
Size of userDefinedType, in bytes.

Error Codes

If the method fails, an error is raised and Err.Number will be set.

Remarks

SetMessageData can be used only to set the entire contents of a message. It must not be called more than once per message, nor can it be mixed with calls to other write methods. The data should be retrieved by using DirectPlayMessage.GetMessageData.

It is recommended that this method be employed by advanced users only. In most cases, it is better to construct message data by using the DirectPlayMessage.WriteX methods, then read back the data with the corresponding DirectPlayMessage.ReadX methods.