KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q28208: Printing Delayed when DOS PRINT Command Invoked from SHELL

Article: Q28208
Product(s): See article
Version(s): 2.00 2.01 3.00 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | B_BasicCom | mspl13_basic
Last Modified: 7-FEB-1989

If you invoke the DOS Print utility during a SHELL, the printer output
does not print until you exit QuickBASIC. This problem occurs because
DOS Print is a terminate-and-stay-resident (TSR) program.

Note: You should never install a TSR program, such as DOS Print, with
the SHELL statement because it fragments memory. This can result in
the following error messages: "Out of Memory" and "Program Too Large
to Fit in Memory". You must reboot to eliminate the memory
fragmentation.

If you must SHELL to a TSR program, it must have been installed in
memory before running the QuickBASIC program. Note: Many TSR programs
may conflict with QuickBASIC with other symptoms, and may not be
compatible.

We do not recommended you use DOS Print, or any TSR program, with
QuickBASIC. Due to a memory conflict, the printing will be delayed
when the DOS Print is invoked during the execution of a SHELL command.

In the first example below, printing occurs immediately because the
Print is invoked (i.e., loaded into memory) prior to the running of
QuickBASIC. In this case, Print takes a portion of memory for its
buffer, QuickBASIC loads, the SHELL executes, and the previously
allocated buffer is used.

If DOS Print is initially invoked by the SHELL statement itself, then
printing does not occur until after exiting QuickBASIC. In this case
QuickBASIC loads, the SHELL executes, Print tries to set up the buffer
but does not have enough room so it spools. Once memory is freed up,
either after exiting QuickBASIC or after the SHELL is executed, a
print buffer can be allocated and the DOS Print is executed. Similar
limitations occur in earlier versions of the QuickBASIC compiler.

Below is the first example. DOS Print is loaded prior to running
QuickBASIC, and no delayed printing occurs in the following example:

1. Invoke DOS Print utility. Resident portion of Print gets loaded
   into memory.

2. Invoke the QuickBASIC editor (QB.EXE).

3. Run the following program:

             CLS
             Shell "print filename"
             End

Below is the second example. DOS Print is loaded by the SHELL
statement itself, and printing is delayed until after leaving
QuickBASIC, and memory is fragmented in the following example:

1. Reboot.

2. Invoke the QuickBASIC editor (QB.EXE).

3. Run the program above. Print loads resident portion.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.