Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function execWait( strFile, strPath, strOpts : String ) : Boolean;
{ ---------------------------------------------------------------
Executes an external program and waits for it to exit. The
parameters are:
-- strFile: The name of the program to execute
-- strPath: The directory to use.
-- strOpts: Any command line options needed.
The return value indicates whether or not the application executed and
completed sucessfully (TRUE) or not (FALSE). If an error occurs, it's
displayed here.
Please note that this implementation is based on Pat Richey's
WinExecAndWait32, as posted to several newsgroups over the past
couple of years; for more info, search groups.google.com
--------------------------------------------------------------- }
var
si : tStartupInfo; { Startup info for spawned process }
pi : tProcessInformation; { Process handle for spawned process }
dwRetval : dWORD; { Return value from createProcess }
begin
{ Initialize the startup info record }
fillChar( si, sizeOf( si ), #0 );
with si do
begin
cb := Sizeof( StartupInfo );
dwFlags := STARTF_USESHOWWINDOW;
wShowWindow := sw_ShowNormal;
end; { with }
{ try to launch the application }
if not createProcess( nil, pchar( strPath + strFile + ' ' + strOpts ), nil,
nil, FALSE, CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS,
nil, pchar( strPath ), si, pi ) then
begin
dwRetval := getLastError; { save system error info }
{ display interpreted error }
msgError( 'Can''t Run Program',
'Reason: ' + sysErrorMessage( dwRetval ) + #10#10 +
'File: "' + strFile + '"' + #10 +
'Path: "' + strPath + '"' + #10 +
'Opts: "' + strOpts + '"' );
result := FALSE; { trigger offer to cancel remaining items }
end
else
begin
repeat
application.processMessages; { wait }
until ( WaitforSingleObject( pi.hProcess, 500 ) <> WAIT_TIMEOUT );
GetExitCodeProcess( pi.hProcess, dwRetval ); { saved for future use }
CloseHandle( pi.hProcess ); { clean up }
CloseHandle( pi.hThread );
result := TRUE;
end;