Running a child Window inside a Viewer

Thomas Spiess (spiess@SPECTRAWEB.CH) writes:

> > Is it possible to run a non-ToolBook program inside a viewer? If so,
> > how?
>
> You start a program in toolbook with
>
>   run "C:\windows\clock.exe"
>
> But this will open a new window. It will not run in a toolbook-viewer.


Try this:

    to handle buttonClick
        linkDLL "user"
            WORD findWindow (STRING, STRING)
            WORD setParent (WORD, WORD)
        end

        run "clock.exe"

        do
            get findWindow ("clock", NULL)
        until it <> 0

        get setParent (it, clientHandle of mainWindow)
    end
This makes the parent window of the clock the client area of the mainWindow. Now, you can get really devious here and do things like removing the click windows caption bar and border, then make it the child window of a viewer. Position the clock window at 0,0 (you need to use API functions to do all this), and size it to the client size of the viewer. Then, in the sized handler of the viewer, resize the clock window to fit the viewer, and you effectively have the clock wrapped in a Toolbook viewer. You can do this for any app you like. I've even ripped out the child window of one app and made it the child window of my Toolbook app, though this tends to make windows crash ;-)

Tim.

 ---------------------------------------------------------------------------
Tim Barham
tbarham@vcrpmap.telecom.com.au
 ---------------------------------------------------------------------------
brianp@u.washington.edu
University of Washington
Box 357260
Seattle, WA 98195-7260
206/543-9175