Discuss this help topic in MsgConnect Forum

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



Messenger.SendMessageCallback

Messenger     See also    


Sends a message to the recipient, request reply and return immediately. Callback function is called when reply is available or message is returned with failure.

Declaration

[C++]
    void SendMessageCallback(char* Destination, MCMessage* Message, MCNotifyProc NotifyProc, unsigned long UserData, MCMessageCredentials* Credentials);

[Pascal]
    procedure SendMessageCallback(Destination : string; var Message : TMCMessage; NotifyProc : TMCNotifyProc; UserData : DWORD; Credentials : PMCMessageCredentials);

[VB6]
    Sub SendMessageCallback(Destination As String, Message As IMCXMessage, Credentials As MCXMessageCredentials)

[ActiveX]
    HRESULT _stdcall SendMessageCallback([in] BSTR Destination, [in] IMCXMessage * Message, [in] IMCXMessageCredentials * Credentials);

NotifyProc parameter is not available. Callback is implemented as OnCompletion event in MCXMessenger object.

[C#]
    public void SendMessageCallback( string Destination, MCMessage Message, MCNotifyProc CompletionProc, object UserData, MCMessageCredentials* Credentials);

[VB.NET]
    Public Sub SendMessageCallback(ByVal Destination As String, ByVal Message As MCMessage, ByVal CompletionProc As MCNotifyProc, ByVal UserData As Object, ByVal Credentials As MCMessageCredentials)

[Java]
    public void sendMessageCallback( String Destination, MCMessage Message, MCNotifyProc completionProc, Object userData, MCMessageCredentials credentials);

[Java ME]
    public synchronized void sendMessageCallback( String Destination, MCMessage Message, MCNotifyProc completionProc, Object userData, MCMessageCredentials credentials);

[Palm]
    void SendMessageCallback( char* Destination, MCMessage* Message, MCNotifyProc CompletionProc, DWORD UserData, MCMessageCredentials* Credentials);

[DLL]
    long __stdcall MCMessengerSendMessageCallback(HMCMessenger h, char* Destination, MCMessage* Message, MCNotifyProc NotifyProc, unsigned long UserData, MCMessageCredentials* Credentials);

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
  • NotifyProc - The function that will be called when the reply is received or the message is returned as failed.
  • UserData - Application-defined parameter that will be passed as a first parameter of the NotifyProc function. This lets you set NotifyProc to a reference to class memeber, and pass an instance reference in UserData parameter
  • Credentials - (optional) Credentials to be set for the message. Can be set to null (nil) if credentials system is not used. See more here

Return value

[DLL]
    MC_OK is always returned.

Description

    Call this method to send the message to some other messenger and be notifed when the result arrives or the message is returned as failed. 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.
    Result of the message is passed together with message data to the callback function defined by NotifyProc. For information about error and timeout handling see Error and Timeout Handling topic.

Discuss this help topic in MsgConnect Forum