Compartilhar via


How TUI Uses ATL (Windows CE 5.0)

Send Feedback

The TUI user interface implementation relies heavily on ATL window classes. All user interface objects, which are documented in TUI UI Object Model, are Win32 windows and use ATL to implement their window procedures and other expected Win32 window functionality.

Note   The TUI Win32 window hierarchy is different from the TUI object hierarchy. For more information about the relationship between these hierarchies, see TUI Object and Window Hierarchies.

As an example, this topic explains the Desktop window, which is the top-most window in the TUI window hierarchy. The organization and files for other windows follow the same structure.

All files mentioned in the following list are in directories beneath %_WINCEROOT%\Public\VoIP\Oak\Phone\TUI. The provided ATL macros and other definitions exist in %_WINCEROOT%\Others\ATL\Include\atlwin.h. For general information about ATL, see the documentation at this Microsoft Web site.

Conceptually, an ATL window consists of two pieces:

  • The C++ wrapper class

    Clients use this class to interact with the window.

    The class inherits from the ATL CWindow class and is generally small, consisting primarily of C++ methods that in turn call SendMessage to interact with the actual window implementation (explained in the next bullet).

    Clients could interact with the window implementation by calling SendMessage directly, but the C++ wrapper class provides type safety. It does this by accepting only parameters of the correct type, and then casting these parameters to the appropriate SendMessage WPARAM and LPARAM types.

    Using the wrapper class methods produces more readable code because calling code contains calls to well-named methods instead of verbose SendMessage calls.

    In the TUI, all C++ wrapper classes are defined in Inc\VoIPControls.hxx. This file contains the TUI CVoIPDesktop class, among others.

  • The window implementation

    All Win32 windows have a window procedure that handles all window messages posted to the window.

    Code that uses the ATL window classes can implement their window procedures by defining C++ methods as well as a macro that maps message codes to methods. All window procedure code is provided by ATL and does not exist in the window implementation.

    An ATL window implementation consists of a C++ class that inherits from the ATL CWindowImpl class. The CWindowImpl class (and its parents) provides common window functionality, including the window procedure.

    The class a developer implements contains a BEGIN_MSG_MAP macro, which precedes lines like the following:

    MESSAGE_HANDLER(WM_CREATE, OnCreate)
    

    This line maps all WM_CREATE messages to the class's OnCreate method. When the window receives a WM_CREATE message, provided ATL code calls the OnCreate method.

    After the message map, the remainder of the class consists of methods referenced in the message map.

    In the TUI, the window implementation classes reside in the Controls directory. For example, the Desktop.h file contains the class definition for the desktop window implementation, and Desktop.cpp contains method implementations.

    TUI window implementation classes inherit from CVoIPWindowImpl, which in turn inherits from the ATL CWindowImpl class. CVoIPWindowImpl provides general TUI window functionality and is defined in Controls\VoIPWindowImpl.h.

See Also

Understanding TUI Source Code

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.