Shell_ExecuteWithTimeout
Description
Section titled “Description”Executes specified program/command using specified options
Syntax
Section titled “Syntax”Shell_ExecuteWithTimeout(sProgram, sArgument, bCheckProgramExistence, iTimeout) As Boolean
Parameters
Section titled “Parameters”sProgram (String)
Section titled “sProgram (String)”Program/command to execute
sArgument (String)
Section titled “sArgument (String)”Command line arguments
bCheckProgramExistence (Boolean)
Section titled “bCheckProgramExistence (Boolean)”Check for existence of program
iTimeout (Integer)
Section titled “iTimeout (Integer)”How long in minutes should the function wait for the process to exit. If the timeout is reached, the process keeps running.
Return value
Section titled “Return value”Boolean, TRUE if the process was started. The function doesn’t fail when the exit code isn’t 0.
- If the process ends before the timeout, gbValue is TRUE and giErrorLevel contains the exit code.
- If the timeout is reached, gbValue is FALSE. The ID of the process is in giProcessID.
Example
Section titled “Example”If bStatus Then bStatus = Shell_ExecuteWithTimeout(gsWindowsDir & "\Regedit.exe", gsTempDir & "\Regfile.reg /S", True, 30)If bStatus Then If Not gbValue Then 'Handle timeout situations. ID of started process can be found with giProcessID ElseIf giErrorLevel <> 0 Then 'Process exited with an error End IfEnd If