home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / PASCAL / SPOOL / PR.PAS next >
Pascal/Delphi Source File  |  1987-12-13  |  4KB  |  75 lines

  1. PROGRAM Pr;             { Multiplex Interrupt Test                   }
  2. {$R-,S-,I-,D-,T-,F-,V-,B-,N-}
  3. {$M 16384,0,655360 }
  4. {                                                                    }
  5. {            PR.PAS - Interrupt $24 (Multiplex) Demonstration        }
  6. {                                by                                  }
  7. {                          Duane L. Geiger                           }
  8. {                                                                    }
  9.   USES DOS,CRT,Spool;
  10.  
  11.   VAR
  12.     Installed : Boolean;          { Print Spooler Installed Switch   }
  13.     Name      : PathName;         { Full Path and Filename           }
  14.     Ch        : Char;             { Used to Pause the Program        }
  15.  
  16.   BEGIN
  17.     {  The first demonstration is to see if SHARE is installed.  The }
  18.     {  same technique used to detect share can also be used to test  }
  19.     {  any utility which supports 'Get Installed State'.             }
  20.  
  21.     Installed:=ShareInstalled;         { If Share is Installed       }
  22.     WriteLn('Share Installed: ',Installed,' Error:',Error);
  23.  
  24.     {  The next part of the program simply checks to see if you have }
  25.     {  Print.Com installed, and if you have DOS Ver 3.0 or greater.  }
  26.     {  If either condition is not met, an error is returned.         }
  27.  
  28.     Installed:=SpoolerInstalled;       { If Print Spooler Installed  }
  29.     WriteLn('Print.Com Installed: ',Installed,' Error:',Error);
  30.     IF NOT Installed THEN Halt(Error); { Can't Continue this Program }
  31.  
  32.     {  Now Queue up a name to the print program.                     }
  33.  
  34.     Name:='Pr.Pas';                    { Name of Actual File to Que  }
  35.     Write('Submitting: ',Name,' - ');  { Print a Test Message        }
  36.     SpoolerSubmit(Name);               { Submit Name to Spooler      }
  37.     IF OK THEN WriteLn('Successful')   { Everything went OK          }
  38.     ELSE WriteLn('Error encountered:',Error); { Display Error Message}
  39.  
  40.     Name:='Spool.Pas';                 { Submit another file to print}
  41.     Write('Submitting: ',Name,' - ');  { Display a message           }
  42.     SpoolerSubmit(Name);               { Submit Name(s) to Spooler   }
  43.     IF OK THEN WriteLn('Successful')   { Did it work correctly?      }
  44.     ELSE WriteLn('Error encountered:',Error); { of Produce an Error  }
  45.  
  46.     WriteLn('Press Any Key to Continue');   { Now printing PR.PAS    }
  47.     REPEAT UNTIL KeyPressed;           { Wait for a Keystroke        }
  48.     REPEAT Ch:=Readkey; UNTIL NOT KeyPressed; { Flush keyboard       }
  49.  
  50.     SpoolerStatusRead;                 { Pause and display queue     }
  51.     IF OK THEN WriteLn('Successful')   { OK on status read           }
  52.     ELSE WriteLn('Error encountered:',Error); { An Error of some type}
  53.  
  54.     WriteLn('Press Any Key to Continue');   { Another pause          }
  55.     REPEAT UNTIL KeyPressed;           { Get a keystroke             }
  56.     REPEAT Ch:=Readkey; UNTIL NOT KeyPressed; { Flush keyboard again }
  57.  
  58.     Write('Spooler Release - ');       { Print test message          }
  59.     SpoolerStatusEnd;                  { Start up the print job again}
  60.     IF OK THEN WriteLn('Successful')   { It went OK                  }
  61.     ELSE WriteLn('Error encountered:',Error); { or it failed somehow }
  62.  
  63.     Write('Canceling: ALL - ');        { Message declaring intent    }
  64.     SpoolerCancelAll;                  { Cancel entire print queue   }
  65.     IF OK THEN WriteLn('Successful')   { It was successful or        }
  66.     ELSE WriteLn('Error encountered:',Error); { it somehow failed    }
  67.  
  68.     Name:='Pr.Pas';                    { Cancel Individual filename  }
  69.     Write('Canceling: ',Name,' - ');   { Display test message        }
  70.     SpoolerCancel(Name);               { Cancel by name              }
  71.     IF OK THEN WriteLn('Successful')   { It will work                }
  72.     ELSE WriteLn('Error encountered:',Error); { or fail              }
  73.  
  74.   END.
  75.