.BIN Routine for Releasing Network Print Spooler

Last reviewed: April 17, 1995
Article ID: Q98687
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 1.02, 2.0, 2.5, and 2.5a
  • Microsoft FoxBASE+ for MS-DOS, version 2.1

SUMMARY

To release the network print spooler after sending information to the printer, you can write a .BIN routine using the MS-DOS Debug program, as explained below.

MORE INFORMATION

To create the .BIN routine, use the code below. Do not type the semicolons or explanations following the semicolons.

   C:\>debug             ; At the MS-DOS prompt, type DEBUG.
   -nSP_OUT.BIN          ; Provide a filename with a .BIN extension.
   -a 100                ; Assemble at address 100.
                         ;
                         ; The address segment after the colon is
                         ; significant--the first 4 numbers may differ.
   2883:0100 MOV AX,5F04 ; Load the printer output control code
                         ; (for 3Com, LANtastic, or LAN Manager,
                         ; change 5F04 to 5D09;
                         ; 5F04 cancels network redirection of device).
   2883:0103 INT 21      ; Call the MS-DOS interrupt routine.
   2883:0105 RETF        ; FoxPro-called routines need far return.
   2883:0106             ; Press ENTER at the blank line.
                         ;
   -rbx                  ; Access the base register.
   bx 0000               ; This should be 0000; if so, press ENTER. If
   :                     ; it is anything else, type 0 and press ENTER.
   -rcx                  ; Access the count register.
   cx 0000               ; Disregard whatever is here; it will be
   :6                    ; changed to 6 bytes.
   -w                    ; Write the program to disk.
   Writing 0006 bytes    ; Message confirms write.
   -q                    ; Quit to MS-DOS.

To use SP_OUT.BIN, load it early in the program, and then call it at the points where output to the printer is completed. For example:

   LOAD sp_out             && Loads SP_OUT.BIN.
   SET PRINTER TO LPT2:
   SET DEVICE TO PRINT
   @ .... SAY .......      && Printer output goes here.
   @ .... SAY .......
   CALL sp_out             && Begin printing (call not needed
                           && with LANtastic).
   SET DEVICE TO SCREEN
   RELEASE MODULE sp_out   && Release SP_OUT.BIN when finished.

This callable .BIN routine closes an open LAN spool file on some networks without you having to issue a SET PRINTER TO \\SERVER\PRINTER command. This routine should be useful in multiuser FoxBASE+ environments because the SET PRINTER TO command that can be used in FoxPro does not close the spool file in FoxBASE+, making it necessary for the user to press CTRL+ALT+PRINT SCREEN or use the .BIN routine.


Additional reference words: FoxDos 2.00 2.10 2.50 2.50a print network bin
spool
KBCategory: kbprg kbcode
KBSubcategory:


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.

Last reviewed: April 17, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.