TIP: Click on subject to list as thread! ANSI
echo: delphi
to: STEVE BATSON
from: FRANCOIS PIETTE
date: 1996-08-22 22:05:00
subject: WinExecAndWait for Delph 2?

Salut Steve Batson !
Dans un message de Steve Batson dat‚ du 21 Aug 96  08:28:31 il ‚tait dit:
  SB> I got the following code from the Borland Web site and I think
  SB> I have seen it or something like it here in the past. Anyway, this
  SB> only works in Delphi 1.x, does anyone have a Delphi 2.0 function that
  SB> will do the same thing? Or, if you know how to modify it, that would
  SB> be helpful. Here is the function: Function WinExecAndWait(Path :
Here is some code extracted from one of my applications. It should do 
what you are looking for. Let me know if it does.
function StartApplication(ExeName : String): Boolean;
var
    StartupInfo: TStartupInfo;
    ProcessInfo: TProcessInformation;
begin
    FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
    with StartupInfo do begin
        cb          := SizeOf(TStartupInfo);
        dwFlags     := STARTF_USESHOWWINDOW or STARTF_FORCEONFEEDBACK;
        wShowWindow := SW_SHOWNORMAL;
    end;
    Result := CreateProcess(nil, PChar(ExeName), nil, nil, False,
                            NORMAL_PRIORITY_CLASS, nil, nil,
                            StartupInfo, ProcessInfo);
    if Result then begin
        with ProcessInfo do begin
            WaitForInputIdle(hProcess, INFINITE);
            WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
            CloseHandle(hThread);
            CloseHandle(hProcess);
        end;
    end;
end;
Amiti‚s,
{-Francois Piette-}
--- SvFido 1.32
---------------
* Origin: OverByte BBS (Embourg-Belgium) 32-41-651395 V-FAST (2:293/2202)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.