Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Blinker 5.10 Online Reference - <b> swpruncmd() / swpruncmdbas()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SWPRUNCMD() / SWPRUNCMDBAS()
------------------------------------------------------------------------------
 Purpose:
 Execute a child process.

 Syntax:
 lValue = SWPRUNCMD(cCommand,nuMem,cRunPath,cTempPath)

 Parameters:
 cCommand  Command to execute.

 nuMem Memory to make available in Kb.
 cRunPath Drive and directory to set.
 cTempPath   Where to create temporary file.

 Returns:
 TRUE if the command interpreter was executed. FALSE if an error occurred

 Description:
 This function executes a child process of the current program, freeing
 conventional memory occupied by the parent program. Any non conventional
 memory used by the parent will remain allocated.

 The parameters to SWPRUNCMD() are as follows:
 cCommand: The name of the program, batch file or DOS internal command to be
 executed, followed by any required parameters. An empty string will cause
 the command interpreter to be loaded, giving a DOS prompt.
 nuMem: The amount of memory in kilobytes (Kb) to be freed prior to executing
 the child process. If this parameter is passed as zero, as much memory as
 possible will be freed.
 cRunPath: The drive and directory to make current prior to executing the
 child process.
 cTempPath: The drive and directory where the swap function should create a
 disk swap file containing the image (or partial image) of the parent
 program. Note that XMS and EMS memory will be used in preference to a disk
 swap file if available provided their use has not been prohibited through
 the use of SWPUSEEMS() and SWPUSEXMS().
 Note that this parameter may be overridden at runtime through the use of the
 SWAP or BLINKER environment variables. For example:

 SET SWAP=F:\TEMP;
 Or
 SET BLINKER=/SDF:\TEMP
 will cause the temporary disk file to be created in F:\TEMP, regardless of
 the value passed as a parameter to the SWPRUNCMD().
 The swap function will always invoke the current command interpreter as
 specified in the COMSPEC environment variable, which in turn will execute
 cCommand. This allows the parent program to execute any internal or external
 DOS command, a batch file or any program which can be executed from the DOS
 prompt. The return code of the child process can be retrieved using the
 function SWPERRLEV().
 The return value is a logical (Boolean) value indicating the success of the
 SWPRUNCMD() call. Following an unsuccessful call to SWPRUNCMD(), the program
 can use SWPERRMAJ() and SWPERRMIN() to determine the nature of the error.

 Example:
 success = SWPRUNCMD("",0,"","")                                             

 Shell to DOS, freeing as much memory as possible, and save swap file to
 current directory if required.
 success = SWPRUNCMD("WIN",0,"C:\WINDOWS","F:\")
 This command will execute Microsoft Windows, freeing as much memory as
 possible. The swap function will change drive and directory to C:\WINDOWS
 prior to executing the WIN command. If a temporary disk swap file is
 required, it will be created on F:\
 success = SWPRUNCMD("DIR /W",100,"","")
 IF (!success)
    ? "Swap failed"
    majerr = SWPERRMAJ()
    minerr = SWPERRMIN()
    ? "Error codes :", majerr, minerr
 ELSE
    ? "Swap succeeded"
    ? "Errorlevel :", SWPERRLEV()
 ENDIF
 Execute the DOS DIR command, first freeing 100 Kb, create the swap disk file
 to the current directory if required. On return, check the swap function
 return code. If the swap failed display the swap major and minor error
 codes, if it succeeded, display the return code of the child process.

 success = SWPRUNCMD("RRUN ABC",0,"","")
 IF (!success)
    ? "Swap failed"
       majerr = SWPERRMAJ()
       minerr = SWPERRMIN()
       ? "Error code :", majerr, minerr
    ELSE
    ? "Swap succeeded"
    ? "Errorlevel :",SWPERRLEV()
 ENDIF
 Execute the R & R report writer, checking for errors on return.

See Also: SWPERRLEV() SWPERRMAJ() SWPERRMIN()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson