CMessageLoopDefaultImpl Class

class CMessageLoopDefaultImpl

This class provides a default implementation for an application's message loop. The general structure for most applications is to create a main window, run the message loop (via GetMessage/DispatchMessage) and finally destroy the main window when the WM_QUIT message is received). CCreateWindowMessageLoop fills in the two virtual functions for managing the window: by deriving from a message loop-derived class (CMessageLoopBase by default)

CMessageLoopDefaultImpl is capable of managing several message pre-translators and idle handlers. You add message pre-translators and idle handlers to the message loop using AddMessagePreTranslator and AddIdleHandler. CCreateWindowMessageLoop runs the message loop by calling the pretranslators and the idle handlers registered with the message loop.

Member functions include:  AddMessagePreTranslator,  RemoveMessagePreTranslator,  AddIdleHandler,  RemoveIdleHandler,  PreTranslateMessage,  OnIdle

Defined in: Application.h

Class Template Arguments

_Base = CMessageLoopBase

Base class

Class Members

IdleHandlersList  m_lstIdleHandlers

List of idle handlers

MessagePreTranslatorsList  m_lstMessagePreTranslators

List of message translators

void  AddMessagePreTranslator(IMessagePreTranslator* pMsgTrans)

Add a message translator to the loop

void  RemoveMessagePreTranslator(IMessagePreTranslator* pMsgTrans)

Remove a message translator from the loop

void  AddIdleHandler(IIdleHandler* pIdleHandler)

Add an idle handler to the loop

void  RemoveIdleHandler(IIdleHandler* pIdleHandler)

Remove an idle handler from the loop

virtual bool  PreTranslateMessage( MSG* pMsg )

Override message pre-translation

virtual bool  OnIdle( int )

Override idle handling