I am launching a "legacy" DOS app from another cosole app. The display from the old DOS app is extensive and for many repeated launches it comsumes a lot of time. So I have tried to run it using CreateProcess instead of RUNQQ. However, the child app still shows its dos screen. It seems to share the same the caller (i.e. no different from runqq).
I would like to know how to do this to prevent the callee from doing all the elaborate text output.
Here is the heart of the createProcess call:
!STARTUPINOF sets the properties of the thread
call ZeroMemory (LOC (si), SIZEOFSTARTUPINFO)
dwCreate = IOR(HIGH_PRIORITY_CLASS,dwCreate)! /h
dwCreate = IAND(NOT(CREATE_NEW_CONSOLE),dwCreate) !turn off this bit to supress the DOS screen
!set to hide the console window
!other startup info
sa%nLength = SIZESECURITYATTRIBUTES
sa%lpSecurityDescriptor = NULL
sa%bInheritHandle = .true.
sb%nLength = SIZESECURITYATTRIBUTES
sb%lpSecurityDescriptor = NULL
sb%bInheritHandle = .true.
!Get the Path info
call zeromemory (LOC(szPath), len(szPath))
!Run the requested PROGRAM (can we check for return code?)
call zeromemory (LOC(szArgs), SIZEOFszArgs)
szArgs= trim(cmd)//char(0) !watch SIZEOFSzArgs
! szArgs= 'cmd.exe /c '//trim(cmd)//char(0) !watch SIZEOFSzArgs
! res=len_trim(szArgs)+1 ; szArgs(res:res)=char(0)
fSuccess = CreateProcess(null_character, & szArgs, & ! command line (including program name)NULL_security_attributes, & NULL_security_attributes, &
.FALSE., & ! new process inherits handles?
dwCreate, & ! creation flags
NULL, & ! environment
szPath, & ! new current DirName si, & ! STARTUPINFO structure
pi) ! PROCESSINFORMATION structure
Also I would like to know if this scheme can return the exit/return code of the callee the way runqq would. Would it be in fuccess?
Thanks in advance