Thanks for the response, Anatoliy.
The caption of my DOS window was entirely different and I have a hunch that it will be different in other machines. Is there an WinAPI to get a list of all windows that you could call before and after the RUN in order to determine which window belongs to the RUN?
Alex
>Hi Alex,
>
>Here's what happens:
>
>- VFP application issues RUN command
>
>- OS creates a window with class "ConsoleWindowClass" and with -- most likely -- "FoxPro Run Command" caption
>
>- OS starts a process inside the console window
>
>At this point VFP application should call FindWindow API function
>
>DECLARE INTEGER FindWindow IN user32;
> STRING lpClassName,;
> STRING lpWindowName
>
>passing either "ConsoleWindowClass" class name or "FoxPro Run Command" caption, or both as input parameter(s). The handle returned can be used for following SetParent call. The RUN shold be NOWAIT, otherwise the VFP application may halt until the issued RUN returns.
>
>BTW, there's no guarantee that SetParent would work with console windows. On other occasions I found them to be very special animals :)