[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
SWPRUNCMD / SWPRUNCMDBAS
------------------------------------------------------------------------------
Function : Execute a child process.
Syntax : lValue = SWPRUNCMD(cCommand, nuMem, cRunPath, cTempPath)
Return : TRUE if the command interpreter was executed
This function executes a child process of the current program, freeing
memory occupied by the parent program.
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 environment variable. For example :
SET SWAP=E:\TEMP;
will cause the temporary diskfile 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, 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,"","")
Execute the DOS DIR command, first freeing 100KB, save swap disk file
to the current directory if required .
See Also:
SWPERRLEV()
SWPERRMAJ()
SWPERRMIN()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson