Discuss this help topic in MsgConnect Forum

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



Messenger.SendMessageTimeout

Messenger     See also    


Sends a message to the recipient and wait for result for specified time, optionally dispatching incoming messages.

Declaration

[C++]
    bool SendMessageTimeout(char* Destination, MCMessage* Message, unsigned long Timeout, bool Block, MCMessageCredentials* Credentials, long& MsgResult);

[Pascal]
    function SendMessageTimeout(Destination : string; var Message : TMCMessage; Timeout : DWORD; Block : boolean; Credentials : PMCMessageCredentials, var MsgResult : integer) : boolean;

[VB6]
    Function SendMessageTimeout(Destination As String, Message As IMCXMessage, Timeout As Long, Block As Boolean, Credentials As MCXMessageCredentials, MsgResult As Long) As Boolean

[ActiveX]
    HRESULT _stdcall SendMessageTimeout( [in] BSTR Destination, [in] IMCXMessage * Message, [in] long Timeout, [in] VARIANT_BOOL Block, [in] IMCXMessageCredentials * Credentials, [in, out] long * MsgResult, [out, retval] VARIANT_BOOL * res);

[C#]
    public boolean SendMessageTimeout(String Destination, MCMessage Message, int Timeout, bool Block, MCMessageCredentials Credentials, out int MsgResult);

[VB.NET]
    Public Function SendMessageTimeout(ByVal Destination As String, ByRef Message As MCMessage, ByVal Timeout As Integer, ByVal Block As Boolean, ByVal Credentials As MCMessageCredentials, ByRef MsgResult As Integer) As Boolean

[Java]
    public boolean sendMessageTimeout(String destination, MCMessage message, long timeout, boolean block, MCMessageCredentials credentials, MCMessenger.IntegerHolder msgResult);

[Java ME]
    public synchronized boolean sendMessageTimeout(String destination, MCMessage message, long timeout, boolean block, MCMessageCredentials credentials, IntegerHolder msgResult);

[DLL]
    long __stdcall MCMessengerSendMessageTimeout(HMCMessenger h, char* Destination, MCMessage* Message, unsigned long Timeout, bool Block, MCMessageCredentials* Credentials, long* MsgResult, long* res);

Parameters

  • [DLL]h - handle to the Messenger object that was returned by Create method

  • Destination - The address of the message recipient. See more here
  • Message - The message to be sent. See more here
  • Timeout - Time (in milliseconds) after which the method marks the message as failed and returns. Setting this parameter to 0xFFFFFFFF ($FFFFFFFF) causes the method to wait infinitely for reply (in fact, waiting is stopped after time specified by MaxTimeout property elapses)
  • Block - Defines whether the incoming messages should be processed while waiting.
    If Block is true, no incoming messages are dispatched using DispatchMessages.
    If Block is false, DispatchMessages method is called when new incoming messages appear in the input queue.
  • Credentials - (optional) Credentials to be set for the message. Can be set to null (nil) if credentials system is not used. See more here
  • MsgResult - the value that was placed to Result member of the MCMessage structure when the message was handled
  • [DLL, ActiveX]res - result of method execution (see Result for details)

Return value

    Return value is true if the message was sent successfully or false if timeout has expired.
[DLL]
    MC_OK is always returned.

Description

    Call this method to send the message to some other messenger and wait for reply from the recipient for specified time, optionally dispatching incoming messages. Destination specifies the address of the recipient. This method determines the right transport to use and passes the message to the transport. If the transport was not found or the request didn't reach the recipient for some reason, an exception is raised. [DLL] Error is determined by return value.
For information about error and timeout handling see Error and Timeout Handling topic.

Discuss this help topic in MsgConnect Forum