EldoS
MsgConnect home / Documentation / Queue.OnUnhandledMessage event
Navigation
Web site
Support
Table Of Contents

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


Queue.OnUnhandledMessage

Queue     See also    


This event is fired when the handler is not found.

Declaration

[C++]
    typedef void (STDCALLCONV *MCHandleMessageEvent)(void* UserData, void* Sender, MCMessage& Message, bool& Handled);
    public void setOnUnhandledMessage(MCHandleMessageEvent Value, void *UserData = NULL);
    public MCHandleMessageEvent getOnUnhandledMessage(void * *UserData);

[Pascal]
    property OnUnhandledMessage: TMCHandleMessageEvent;
    TMCHandleMessageEvent = procedure (Sender :TObject; var Message : TMCMessage; var Handled : boolean) stdcall of object;

[VB6]
    Event IMCXQueueEvents.OnMessage(Message As IMCXMessage, Handled As Boolean)

[ActiveX]
    void IMCXQueueEvents.OnMessage([in] IMCXMessage * Message, [in, out] VARIANT_BOOL * Handled);

[C#]
    public MCHandleMessageEvent OnUnhandledMessage;
    public delegate void MCHandleMessageEvent(object Sender, MCHandleMessageEventArgs Args);
    public class MCHandleMessageEventArgs:EventArgs
    {
        public MCMessage Message;
        public bool Handled;
    }

[VB.NET]
    Public Event OnUnhandledMessage As MCHandleMessageEvent
    Public Delegate Sub MCHandleMessageEvent(ByVal Sender As Object, ByVal Args As MCHandleMessageEventArgs)
    Public Class MCHandleMessageEventArgs
        Public Message As MCMessage
        Public Handled As Boolean
    End Class

[Java]

    public class MCHandleMessageEvent {
        public MCQueue getSender();
        public MCMessage getMessage();
    }
    public abstract interface MCHandleMessageListener {
        public boolean handleMessage(MCHandleMessageEvent e);
    }
    public void removeUnhandledMessageListener(MCHandleMessageListener l);
    public void addUnhandledMessageListener(MCHandleMessageListener l);

[Java ME]

    public class MCHandleMessageEvent {
        public MCQueue getSender();
        public MCMessage getMessage();
    }
    public abstract interface MCHandleMessageListener {
        public boolean handleMessage(MCHandleMessageEvent e);
    }
    public void removeUnhandledMessageListener(MCHandleMessageListener l);
    public void addUnhandledMessageListener(MCHandleMessageListener l);

[Palm]
    typedef void (STDCALLCONV *MCHandleMessageEvent)(void* UserData, void* Sender, MCMessage& Message, bool& Handled);
    void setOnUnhandledMessage(MCHandleMessageEvent Value, void *UserData= NULL);
    MCHandleMessageEvent getOnUnhandledMessage(void * *UserData);

[DLL]
    void __stdcall MCQueueSetOnUnhandledMessage(HMCMessenger h, HandleMessageProc Code, long UserData);
    void __stdcall MCQueueGetOnUnhandledMessage(HMCMessenger h, HandleMessageProc* Code, long* UserData);
    void (__stdcall *HandleMessageProc)(long UserData, HMC Reserved, MCMessage Message, bool* Handled);

Parameters

  • [DLL]h - handle to the Queue object that was returned by Create method
  • [DLL]Code - pointer to the callback function that is called to handle the message

  • UserData - application-defined data that is passed back to the callback function
  • Message - the message that was sent with given credentials.
  • Handled - set this value to true to tell the queue that the message was handled and false otherwise

Description

    This event is fired by the queue when the handler for the incoming message was not found. It lets the application avoid using handlers and process all messages for the queue in one place. If the application receives a message via this event, it should NOT call Messenger.MessageProcessed method -- the queue will do this automatically.
    Set Handled to true to tell the messenger that the message was processed. If the message was not processed, messenger will set Message.Result to 0.
    It is safe to change the data pointed by Message.Data parameter. If Message.MessageType is BDT_VAR, such changes will be sent back to the message sender. If the application needs to change the size of the data, it can deallocate existing memory block (if any) using MCMemFree function. New block is allocated with MCMemAlloc function. Message.DataSize field should then be set to the size of the new block.
    [Pascal] Note: Delphi/Kylix IDE creates an event handler automatically, but it misses "stdcall" modifier. If you do not place "stdcall" manually for event handler function, it will crash.

MCMessage structure     MCMemAlloc     MCMemFree    

 
Contact Us | Subscribe | Terms of Use | Trademarks | Privacy Statement
Copyright (c) 1998-2005, EldoS Corporation