Swallowing an application

I want to execute an existing application -- lets say a Xterm -- inside
a window of a new application. So I figured I need the window to
pretent to be a display.

I don't even know on which level Xlib, Xt, Xm it has to be done, or
if it can be done outside the wm at all.

Could anybody enlighten me? HInts what or where to start reading
are very welcome.

Any