Discuss this help topic in MsgConnect Forum

Filter: C++  Pascal  C#  VB.NET  Java  Java ME  ActiveX  DLL 



MCMessage


Contains a message that is being sent via Messenger.

Declaration

[C++]
struct MCMessage {
    long long MsgID,
    char Priority,
    long MsgCode,
    long Result,
    long Param1,
    long Param2,
    MCBinDataType DataType,
    long DataSize,
    void* Data,
    MCStream* DataStream
};

[Pascal]
  TMCMessage = record
    MsgID : Int64;
    Priority : SmallInt;
    MsgCode : Integer;
    Result : Integer;
    Param1 : Integer;
    Param2 : Integer;
    DataType : TMCBinDataType;
    DataSize : Integer;
    Data : Pointer;
    DataStream : TStream
  end;

[VB6]
Class MCXMessage
    Property MsgID As String
    Property Priority As Integer
    Property MsgCode As Long
    Property Result As Long
    Property Param1 As Long
    Property Param2 As Long
    Property BinDataType As MCXBinDataType
    Property BinData As Variant
End Class

[ActiveX]
     interface IMCXMessage: IDispatch
    {
    HRESULT _stdcall MsgCode([out, retval] long * Value );
    HRESULT _stdcall MsgCode([in] long Value );
    HRESULT _stdcall Param1([out, retval] long * Value );
    HRESULT _stdcall Param1([in] long Value );
    HRESULT _stdcall Param2([out, retval] long * Value );
    HRESULT _stdcall Param2([in] long Value );
    HRESULT _stdcall Result([out, retval] long * Value );
    HRESULT _stdcall Result([in] long Value );
    HRESULT _stdcall BinData([out, retval] SAFEARRAY(byte) * Value );
    HRESULT _stdcall BinData([in] SAFEARRAY(byte) Value );
    HRESULT _stdcall BinDataType([out, retval] MCXBinDataType * Value );
    HRESULT _stdcall BinDataType([in] MCXBinDataType Value );
    };
     interface IMCXMessage2: IMCXMessage
    {
    HRESULT _stdcall MsgID([out, retval] BSTR * Value )
    HRESULT _stdcall MsgID([in] BSTR Value );
    HRESULT _stdcall Priority([out, retval] short * Value )
    HRESULT _stdcall Priority([in] short Value );
    };

[C#]
public struct MCMessage {
    public long MsgID,
    public sbyte Priority,
    public int MsgCode,
    public int Result,
    public int Param1,
    public int Param2,
    public MCBase.MCBinDataType DataType,
    public int DataSize,
    public byte[] Data,
    public Stream DataStream
};

[VB.NET]
Public Struct MCMessage
    Public MsgID As Long
    Public Priority As SByte
    Public MsgCode As Integer
    Public Result As Integer
    Public Param1 As Integer
    Public Param2 As Integer
    Public DataType As MCBinDataType
    Public DataSize As Integer
    Public Data As Byte()
    Public DataStream As Stream
End Struct

[Java]
    class MCMessage()
    long getMsgID(),
    void setMsgID(long msgID),

    byte getPriority(),
    void setPriority(priority),

    int getMsgCode(),
    void setMsgCode(msgCode),

    int getResult(),
    void setResult(int result),

    int getParam1(),
    void setParam1(int param),

    int getParam2(),
    void setParam2(int param),

    byte getDataType(),
    void setDataType(byte dataType),

    int getDataSize(),

    byte[] getData(),
    void setData(byte[] data)

    byte[] getDataStream(),
    void setDataStream(MCStream dataStream)
    };

[DLL]
struct MCMessage {
    __int64 MsgID,
    char Priority,
    long MsgCode,
    long Result,
    long Param1,
    long Param2,
    long DataType,
    long DataSize,
    void* Data
    };

Fields

  • MsgID - internal ID of the message. Should NEVER be changed by the application.
  • Priority - message priority. The value can vary from -128 to 127, default is 0. See Message priorities for details
  • MsgCode - application-defined message code. Use this message code to identify the message on the recipient side.
  • Result - application-defined result of message processing.
  • Param1 - application-defined parameter of the message.
  • Param2 - application-defined parameter of the message.
  • DataType - defines the type of the message. If this value is BDT_CONST, the data passed in Data will not be sent back to the message sender. If this value is BDT_VAR, the data in Data can be changed and the changes will be sent back to the sender.
  • DataSize - size of associated binary data.
  • Data - binary data, associated to the message. Use Data or DataStream (not both) to pass data.
  • DataStream - binary data, associated to the message. Use Data or DataStream (not both) to pass data. DO NOT use DataStream when communicating with ActiveX or DLL code packages.

Description

    MCMessage structure contains a message that is being transferred. When sending the message, the application must fill the following fields: MsgCode, Param1, Param2, DataSize, Data. When associating a binary data block, the application must use MCMemAlloc function to allocate memory. This block is NOT disposed of by Messenger and the application must call it after the call to PostMessage() or SendMessage*() is complete.
    When the message is being prepared for sending, application must set the value of DataSize to the size of associated memory block, referenced by Data parameter (or 0 if there was no memory block associated with the message).
    When the message is processed and the application needs to return another block to the sender (in case of BDT_VAR value of DataType field), it should use MCMemFree function to dispose of existing data. New block is allocated with MCMemAlloc function. DataSize field should then be set to the size of the new block.
    Message data should not be changed if the DataType parameter is BDT_CONST.
    After the message was processed, set Result field to the result of message processing. It will be sent back to the sender of the message (if the message was sent with one of SendMessage* functions).

DataStream is an alternative to Data and DataSize properties. You can use either Data or DataStream to pass your data (DO NOT use DataStream when communicating with ActiveX or DLL code packages). Message receiver will receive the data in the field via which this data was sent by the sender.

    You can initialize the message using one of the following methods:

Discuss this help topic in MsgConnect Forum