Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Program too big" error when shelling in XP

Status
Not open for further replies.

scoundrel86

Programmer
Aug 21, 2004
4
US
I have a problem. I wrote a program using QB4.5 to take a file created by a DOS program, print it to a postscript file, and then pass it to ghostscript (v8.13 or v8.15) to convert it to a pdf, then launch the default viewer. The program works great under Win98se, but is having problems under XP. I have resolved the issues with the launch of the pdf (START command) and some issues with shelling to batch files (using cmd /c), but the problem I am having right now is when I try to run ghostscript from the batch file in a shell. I am getting a "Program too big to fit in memory" error. I have tried playing with the memory settings for the pif and have stripped the autoexec.nt and config.nt file to maximize available memory. I even put the "mem /c" command in the batch file prior to running ghostscript and verified that the available memory is about the same between Win98se and XP. I am able to shell other programs without error, but can't seem to get ghostscript to run in the shell. (Yes, I tried to run the batchfile external from my program and it ran ok.)

Any suggestions as to what I can try next?
 
Try this.
Start QB with a batch file that includes a call to another bat file.

i.e.
@echo off
cd\qb45
call myprog.exe

call X.bat

-----------
in myprog, open x.bat for output and put whatever you want
in it, close it, then exit the program. the original bat file should run x.bat which should save some memory.


Another trick is to make a small program with just the
shell statement shell "whatever.exe"

and chain the that smaller program (this will not save as
much as the other way but I have found it usefull).

 
Thanks Buff1, but I was hoping to have a single executable as this program will be set up on multiple computers, so I wanted as simple an installation as possible. Late last night I found an acceptable solution. A problem with XP and QuickBasic is that QuickBasic cannot perform the following:

SHELL "START file.pdf"

QuickBasic is unable to use the START command as it is a system command and not a program. QuickBasic is able to perform other DOS internal commands, but is unable to directly execute the START command. For this reason, I have done as you mentioned, created a batchfile from within the main program to run the offending "memory-hog" from a batch file as well as handle the temp file cleanup. To execute this batchfile in it's own window with a fresh memory model, I used the following statement:

SHELL "cmd /c START filename.bat"

This will shell to cmd, execute the START command which will open a new window and execute filename.bat. This has solved the memory issue as well as keeping everything in one executable.
 
You are interfacing windows programs, so why don't you switch to Visual Basic Script?
No memory problems, you can START whatever you want, even interface with a batch file if you need to do it..
The syntax is not so different from QB, and you have it in every version of windows from W98 (you can download it for older Windows).

Antoni
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top