PRODUCT : Pascal NUMBER : 2000 VERSION : 7.0 OS : WINDOWS DATE : March 23, 1993 PAGE : 1/1 TITLE : Pause your code while you execute another app Code which allows you to launch another Windows program and then wait untilfore executing any more of your code.^@ 1. { Use this code to launch a second program from inside a Turbo Pascal for Windows program. It accepts the same parameters as WinExec, but will loop continuously until the launched program has terminated. This code exists because it is sometimes necessary to launch a second program without executing any more code in your program. If you did not take this approach, then both programs would be executing simultaneously via Windows multitasking abilities. } 2. function WinExecAndWait(Path : Pchar; Visibility : word) : word; var InstanceID : THandle; Msg : TMSg; begin InstanceID := WinExec(Path,Visibility); if InstanceID < 32 then { a value less than 32 indicates an Exec error } WinExecAndWait := InstanceID else repeat while PeekMessage(Msg,0,0,0,PM_REMOVE) do begin if Msg.Message = WM_QUIT then halt(Msg.wParam); TranslateMessage(Msg); DispatchMessage(Msg); end; until GetModuleUsage(InstanceID) = 0; end; PRODUCT : Pascal NUMBER : 2000 VERSION : 7.0 OS : WINDOWS DATE : March 23, 1993 PAGE : 2/1 TITLE : Pause your code while you execute another app DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.