A method and apparatus for adapting and hosting legacy user interface
controls is provided. Legacy user interface controls are exposed within a
new window manager as native user interface objects. A bridge between a
hosted legacy user interface control and the legacy window manager
intercepts messages intended for the hosted user interface control. The
messages are filtered to determine if they should be passed to the new
window manager. If a message is to be forwarded, the message is forwarded
to a root Visual Gadget in the new window manager. The message is
processed and routed down the window tree to an adapter control for
hosting the legacy user interface control. The adapter control processes
the message and routes the message to any listener objects attached to
the adapter. If the message has not been completely handled, the message
is "bubbled" up the window tree to the parent objects of the adapter
control for additional processing.